Skip to content

Commit 264f7be

Browse files
authored
Merge pull request #78 from datashield/v6.0-dev
Merge v6.0 development into master for release
2 parents be5f54a + bb3645b commit 264f7be

97 files changed

Lines changed: 4090 additions & 632 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
*.dll
55
*.Rproj
66
.Rproj.user
7+
.DS_Store

DESCRIPTION

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
11
Package: dsBase
22
Title: DataSHIELD server site base functions
3-
Version: 5.1.0
3+
Version: 6.0.0
44
Author: DataSHIELD Developers <datashield@newcastle.ac.uk>
55
Maintainer: DataSHIELD Developers <datashield@newcastle.ac.uk>
66
License: GPL-3
77
Description: DataSHIELD server site base functions.
88
Imports:
99
RANN,
10-
nlme
10+
nlme,
11+
stringr,
12+
lme4
1113
AggregateMethods:
1214
alphaPhiDS,
1315
asFactorDS1,
1416
asListDS,
1517
checkNegValueDS,
18+
classDS,
19+
corTestDS,
20+
corDS,
1621
covDS,
1722
dataFrameSubsetDS1,
1823
densityGridDS,
1924
dimDS,
2025
glmDS1,
2126
glmDS2,
27+
glmerSLMADS2,
2228
glmSLMADS1,
2329
glmSLMADS2,
2430
heatmapPlotDS,
2531
histogramDS1,
2632
histogramDS2,
33+
lsDS,
2734
isNaDS,
2835
isValidDS,
2936
lengthDS,
37+
levelsDS,
3038
lexisDS1,
3139
listDisclosureSettingsDS,
40+
lmerSLMADS2,
3241
matrixDetDS1,
3342
meanDS,
3443
meanSdGpDS,
@@ -44,23 +53,19 @@ AggregateMethods:
4453
setSeedDS,
4554
table1DDS,
4655
table2DDS,
56+
tableDS,
57+
tableDS2,
4758
tapplyDS,
4859
testObjExistsDS,
4960
tTestFDS2,
5061
varDS,
51-
class=base::class,
52-
colnames=base::colnames,
53-
cor.test=stats::cor.test,
54-
dim=base::dim,
62+
colnamesDS,
5563
exists=base::exists,
5664
is.character=base::is.character,
5765
is.factor=base::is.factor,
5866
is.list=base::is.list,
5967
is.null=base::is.null,
6068
is.numeric=base::is.numeric,
61-
length=base::length,
62-
levels=base::levels,
63-
ls=base::ls,
6469
NROW=base::NROW,
6570
t.test=stats::t.test
6671
AssignMethods:
@@ -77,6 +82,7 @@ AssignMethods:
7782
cbindDS,
7883
cDS,
7984
changeRefGroupDS,
85+
completeCasesDS,
8086
dataFrameDS,
8187
dataFrameFillDS,
8288
dataFrameSortDS,
@@ -96,16 +102,19 @@ AssignMethods:
96102
rBinomDS,
97103
recodeLevelsDS,
98104
recodeValuesDS2,
105+
repDS,
99106
replaceNaDS,
100107
reShapeDS,
101108
rNormDS,
102109
rowColCalcDS,
103110
rPoisDS,
104111
rUnifDS,
112+
sampleDS,
105113
seedDS,
106114
seqDS,
107115
subsetByClassDS,
108116
subsetDS,
117+
tableDS.assign,
109118
tapplyDS.assign,
110119
unListDS,
111120
as.character=base::as.character,
@@ -131,4 +140,4 @@ Options:
131140
default.nfilter.tab=3,
132141
default.nfilter.noise=0.25,
133142
default.nfilter.levels=0.33
134-
RoxygenNote: 7.0.2
143+
RoxygenNote: 7.1.0

NAMESPACE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export(cDS)
1414
export(cbindDS)
1515
export(changeRefGroupDS)
1616
export(checkNegValueDS)
17+
export(classDS)
18+
export(colnamesDS)
19+
export(completeCasesDS)
1720
export(corDS)
21+
export(corTestDS)
1822
export(covDS)
1923
export(dataFrameDS)
2024
export(dataFrameFillDS)
@@ -27,17 +31,21 @@ export(glmDS1)
2731
export(glmDS2)
2832
export(glmSLMADS1)
2933
export(glmSLMADS2)
34+
export(glmerSLMADS2)
3035
export(heatmapPlotDS)
3136
export(histogramDS1)
3237
export(histogramDS2)
3338
export(isNaDS)
3439
export(isValidDS)
3540
export(lengthDS)
41+
export(levelsDS)
3642
export(lexisDS1)
3743
export(lexisDS2)
3844
export(lexisDS3)
3945
export(listDS)
4046
export(listDisclosureSettingsDS)
47+
export(lmerSLMADS2)
48+
export(lsDS)
4149
export(matrixDS)
4250
export(matrixDetDS1)
4351
export(matrixDetDS2)
@@ -63,16 +71,21 @@ export(reShapeDS)
6371
export(recodeLevelsDS)
6472
export(recodeValuesDS1)
6573
export(recodeValuesDS2)
74+
export(repDS)
6675
export(replaceNaDS)
6776
export(rmDS)
6877
export(rowColCalcDS)
78+
export(sampleDS)
6979
export(scatterPlotDS)
7080
export(seqDS)
7181
export(setSeedDS)
7282
export(subsetByClassDS)
7383
export(subsetDS)
7484
export(table1DDS)
7585
export(table2DDS)
86+
export(tableDS)
87+
export(tableDS.assign)
88+
export(tableDS2)
7689
export(tapplyDS)
7790
export(tapplyDS.assign)
7891
export(testObjExistsDS)

R/BooleDS.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ thr <- listDisclosureSettingsDS() #
4545

4646
##########CHECK NOT LONG SPECIFIED VECTOR##############
4747

48-
V1<-eval(parse(text=V1.name))
49-
V2<-eval(parse(text=V2.name))
48+
V1<-eval(parse(text=V1.name), envir = parent.frame())
49+
V2<-eval(parse(text=V2.name), envir = parent.frame())
5050

5151

5252
if(is.character(V1)){
@@ -89,14 +89,14 @@ Boolean.indicator<-integer(length=V1.length)
8989
if(V2.length==V1.length){
9090
for(j in 1:V1.length){
9191
command.text<-paste0(V1.name,"[",j,"]",Boolean.operator,V2.name,"[",j,"]")
92-
Boolean.indicator[j]<-eval(parse(text=command.text))*1
92+
Boolean.indicator[j]<-eval(parse(text=command.text), envir = parent.frame())*1
9393
}
9494
}
9595

9696
if(V2.length==1){
9797
for(j in 1:V1.length){
9898
command.text<-paste0(V1.name,"[",j,"]",Boolean.operator,V2.name)
99-
Boolean.indicator[j]<-eval(parse(text=command.text))*1
99+
Boolean.indicator[j]<-eval(parse(text=command.text), envir = parent.frame())*1
100100
}
101101
}
102102

R/asCharacterDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
asCharacterDS <- function (x.name){
1414

1515
if(is.character(x.name)){
16-
x<-eval(parse(text=x.name))
16+
x<-eval(parse(text=x.name), envir = parent.frame())
1717

1818
}else{
1919
studysideMessage<-"ERROR: x.name must be specified as a character string"

R/asDataMatrixDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
asDataMatrixDS <- function (x.name){
2020

2121
if(is.character(x.name)){
22-
x<-eval(parse(text=x.name))
22+
x<-eval(parse(text=x.name), envir = parent.frame())
2323

2424
}else{
2525
studysideMessage<-"ERROR: x.name must be specified as a character string"

R/asFactorDS1.R

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,31 @@
1111
#'
1212
asFactorDS1 <- function(input.var.name=NULL){
1313

14-
input.var <- eval(parse(text=input.var.name))
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+
#nfilter.stringShort <- as.numeric(thr$nfilter.stringShort) #
22+
#nfilter.kNN <- as.numeric(thr$nfilter.kNN) #
23+
#nfilter.noise <- as.numeric(thr$nfilter.noise) #
24+
nfilter.levels <- as.numeric(thr$nfilter.levels) #
25+
#############################################################
26+
27+
input.var <- eval(parse(text=input.var.name), envir = parent.frame())
1528
factor.levels.present.in.source <- levels(factor(input.var))
29+
num.levels<-length(factor.levels.present.in.source)
30+
max.allowed.levels<-length(input.var)*nfilter.levels
31+
32+
if(num.levels>max.allowed.levels)
33+
{
34+
error.message<-
35+
paste0("FAILED: this variable has too many levels and may be disclosive. The ds.asFactor function allows no more than ",
36+
max.allowed.levels," levels in this particular study. This variable has ",num.levels)
37+
return(list(error.message=error.message))
38+
}
1639

1740
return(factor.levels.present.in.source)
1841

R/asFactorDS2.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#'
2020
asFactorDS2 <- function(input.var.name=NULL, all.unique.levels.transmit=NULL, fixed.dummy.vars=NULL, baseline.level=NULL){
2121

22-
input.var <- eval(parse(text=input.var.name))
22+
input.var <- eval(parse(text=input.var.name), envir = parent.frame())
2323

2424
code.input <- all.unique.levels.transmit
2525
code.c <- unlist(strsplit(code.input, split=","))

R/asIntegerDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
asIntegerDS <- function(x.name){
1717

1818
if(is.character(x.name)){
19-
x <- eval(parse(text=x.name))
19+
x <- eval(parse(text=x.name), envir = parent.frame())
2020
}else{
2121
studysideMessage <- "ERROR: x.name must be specified as a character string"
2222
return(list(studysideMessage=studysideMessage))

R/asListDS.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#' @description Coerces an R object into a list
33
#' @details Unlike most other class coercing functions this is
44
#' an aggregate function rather than an assign function. This
5-
#' is because the {datashield.assign} function in opal deals specially with
5+
#' is because the {datashield.assign} function in the data repository deals specially with
66
#' a created object (newobj) if it is of class list. Reconfiguring the
77
#' function as an aggregate function works around this problem.
88
#' This aggregate function is based on the native R function {as.list}
@@ -25,11 +25,11 @@ asListDS <- function (x.name,newobj){
2525

2626
newobj.class <- NULL
2727
if(is.character(x.name)){
28-
active.text<-paste0(newobj,"<<-as.list(",x.name,")")
29-
eval(parse(text=active.text))
28+
active.text<-paste0(newobj,"<-as.list(",x.name,")")
29+
eval(parse(text=active.text), envir = parent.frame())
3030

31-
active.text2<-paste0("newobj.class<-class(",newobj,")")
32-
eval(parse(text=active.text2))
31+
active.text2<-paste0("class(",newobj,")")
32+
assign("newobj.class", eval(parse(text=active.text2), envir = parent.frame()))
3333

3434
}else{
3535
studysideMessage<-"ERROR: x.name must be specified as a character string"

0 commit comments

Comments
 (0)