Skip to content

Commit c8b8429

Browse files
authored
Merge pull request #40 from datashield/v5.1-dev
V5.1 dev
2 parents 16b0aa4 + 3217b94 commit c8b8429

39 files changed

Lines changed: 573 additions & 798 deletions

DESCRIPTION

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: dsBase
22
Title: DataSHIELD server site base functions
3-
Version: 5.0.0
3+
Version: 5.1.0
44
Author: DataSHIELD Developers <datashield@newcastle.ac.uk>
55
Maintainer: DataSHIELD Developers <datashield@newcastle.ac.uk>
66
License: GPL-3
@@ -17,7 +17,6 @@ AggregateMethods:
1717
dataFrameSubsetDS1,
1818
densityGridDS,
1919
dimDS,
20-
dimDS,
2120
glmDS1,
2221
glmDS2,
2322
glmSLMADS1,
@@ -32,8 +31,6 @@ AggregateMethods:
3231
listDisclosureSettingsDS,
3332
matrixDetDS1,
3433
meanDS,
35-
meanDS,
36-
meanSdGpDS,
3734
meanSdGpDS,
3835
messageDS,
3936
namesDS,
@@ -50,10 +47,10 @@ AggregateMethods:
5047
tapplyDS,
5148
testObjExistsDS,
5249
tTestFDS2,
53-
unListDS,
5450
varDS,
5551
class=base::class,
5652
colnames=base::colnames,
53+
cor.test=stats::cor.test,
5754
dim=base::dim,
5855
exists=base::exists,
5956
is.character=base::is.character,
@@ -64,7 +61,8 @@ AggregateMethods:
6461
length=base::length,
6562
levels=base::levels,
6663
ls=base::ls,
67-
NROW=base::NROW
64+
NROW=base::NROW,
65+
t.test=stats::t.test
6866
AssignMethods:
6967
asCharacterDS,
7068
asDataMatrixDS,
@@ -74,13 +72,13 @@ AssignMethods:
7472
asListDS,
7573
asLogicalDS,
7674
asMatrixDS,
77-
asMatrixDS,
7875
asNumericDS,
7976
BooleDS,
8077
cbindDS,
8178
cDS,
8279
changeRefGroupDS,
8380
dataFrameDS,
81+
dataFrameFillDS,
8482
dataFrameSortDS,
8583
dataFrameSubsetDS2,
8684
listDS,
@@ -109,9 +107,11 @@ AssignMethods:
109107
subsetByClassDS,
110108
subsetDS,
111109
tapplyDS.assign,
110+
unListDS,
112111
as.character=base::as.character,
113112
as.null=base::as.null,
114113
as.numeric=base::as.numeric,
114+
attach=base::attach,
115115
c=base::c,
116116
cbind=base::cbind,
117117
complete.cases=stats::complete.cases,
@@ -131,4 +131,4 @@ Options:
131131
default.nfilter.tab=3,
132132
default.nfilter.noise=0.25,
133133
default.nfilter.levels=0.33
134-
RoxygenNote: 6.1.1
134+
RoxygenNote: 7.0.2

NAMESPACE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Generated by roxygen2: do not edit by hand
22

33
export(BooleDS)
4-
export(alphaPhiDS)
54
export(asCharacterDS)
65
export(asDataMatrixDS)
76
export(asFactorDS1)
@@ -18,6 +17,7 @@ export(checkNegValueDS)
1817
export(corDS)
1918
export(covDS)
2019
export(dataFrameDS)
20+
export(dataFrameFillDS)
2121
export(dataFrameSortDS)
2222
export(dataFrameSubsetDS1)
2323
export(dataFrameSubsetDS2)
@@ -67,7 +67,6 @@ export(replaceNaDS)
6767
export(rmDS)
6868
export(rowColCalcDS)
6969
export(scatterPlotDS)
70-
export(scoreVectDS)
7170
export(seqDS)
7271
export(setSeedDS)
7372
export(subsetByClassDS)

R/alphaPhiDS.R

Lines changed: 0 additions & 135 deletions
This file was deleted.

R/asIntegerDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' \code{ds.asInteger}.
1010
#' @return the object specified by the <newobj> argument (or its default name
1111
#' <x.name>.int) which is written to the serverside. For further
12-
#' details see help on the clientside function \type{ds.asInteger}.
12+
#' details see help on the clientside function \code{ds.asInteger}.
1313
#' @author Amadou Gaye, Paul Burton, Demetris Avraam, for DataSHIELD Development Team
1414
#' @export
1515
#'

R/cDS.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@
1010
#'
1111
cDS <- function (objs) {
1212
# this filter sets the minimum number of observations that are allowed
13-
nfilter <- setFilterDS()
13+
14+
#############################################################
15+
# MODULE 1: CAPTURE THE nfilter SETTINGS
16+
thr <- listDisclosureSettingsDS()
17+
nfilter.tab <- as.numeric(thr$nfilter.tab)
18+
#nfilter.glm <- as.numeric(thr$nfilter.glm)
19+
#nfilter.subset <- as.numeric(thr$nfilter.subset)
20+
#nfilter.string <- as.numeric(thr$nfilter.string)
21+
#############################################################
1422

1523
x <- unlist(objs)
1624

1725
# check if the output is valid and output accordingly
18-
if(length(x) < nfilter){
26+
if(length(x) < nfilter.tab){
1927
if(length(x == 0)){
2028
x <- c()
2129
}else{

R/dataFrameFillDS.R

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#'
2+
#' @title dataFrameFillDS
3+
#' @description An assign function called by the clientside ds.dataFrameFill function.
4+
#' @details This function checks if each study has all the variables compared to the other studies
5+
#' in the analysis. If a study does not have some of the variables, the function generates those
6+
#' variables as vectors of missing values and combines them as columns to the input data frame.
7+
#' Then, the "complete" in terms of the columns dataframe is saved in each server with a name
8+
#' specified by the argument \code{newobj} on the clientside.
9+
#' @param df.name a character string representing the name of the input data frame that will be
10+
#' filled with extra columns with missing values if a number of variables is missing from it
11+
#' compared to the data frames of the other studies used in the analysis.
12+
#' @param allNames.transmit unique names of all the variables that are included in the input
13+
#' data frames from all the used datasources.
14+
#' @return Nothing is returned to the client. The generated object is written to the serverside.
15+
#' @author Demetris Avraam for DataSHIELD Development Team
16+
#' @export
17+
#'
18+
dataFrameFillDS <- function(df.name, allNames.transmit){
19+
20+
datatext <- paste0("data.frame(",df.name,")")
21+
data <- eval(parse(text=datatext))
22+
23+
if(!is.null(allNames.transmit)){
24+
allNames <- unlist(strsplit(allNames.transmit, split=","))
25+
}else{
26+
allNames <- NULL
27+
}
28+
29+
study.colnames <- colnames(data)
30+
missingVars <- allNames[-which(allNames %in% study.colnames)]
31+
32+
numRows <- dim(data)[1]
33+
numCols <- length(missingVars)
34+
35+
mat.new <- matrix(NA, ncol=numCols, nrow=numRows)
36+
37+
df.new <- as.data.frame(mat.new)
38+
colnames(df.new) <- missingVars
39+
df.new <- lapply(df.new, as.numeric)
40+
41+
df.out <- cbind(data, df.new)
42+
43+
return(df.out)
44+
45+
}
46+
# ASSIGN FUNCTION
47+
# dataFrameFillDS
48+

0 commit comments

Comments
 (0)