Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions R/tapplyDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ nfilter.subset<-as.numeric(thr$nfilter.subset) #
#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) #
#########################################################################


if(is.character(X.name)){
X<-eval(parse(text=X.name), envir = parent.frame())
}else{
Expand All @@ -47,7 +46,7 @@ length.test.vector<-rep(NA,num.factors)

for(g in 1:num.factors){
activation.text.0<-paste0("INDEX.factors[",g,"]")
active.factor.name<-eval(parse(text=activation.text.0), envir = parent.frame())
active.factor.name<-eval(parse(text=activation.text.0))
active.factor<-eval(parse(text=active.factor.name), envir = parent.frame())
active.factor
length.test.vector[g]<-length(active.factor)
Expand All @@ -71,35 +70,38 @@ all.complete<-stats::complete.cases(X)

current.factor <- NA
for(j in 1:num.factors){

activation.text.a<-paste0(INDEX.factors[j])
current.factor <- eval(parse(text=activation.text.a), envir = parent.frame())


activation.text.a<-paste0("current.factor <-",INDEX.factors[j])
eval(parse(text=activation.text.a), envir = parent.frame())

all.complete<-all.complete&stats::complete.cases(current.factor)
}

X.complete<-X[all.complete]

for(k in 1:num.factors){
activation.text.b<-paste0("current.factor <-",INDEX.factors[k])
eval(parse(text=activation.text.b), envir = parent.frame())

activation.text.b<-paste0(INDEX.factors[k])
current.factor <- eval(parse(text=activation.text.b), envir = parent.frame())

activation.text.c<-paste0(INDEX.factors[k], "<- current.factor[all.complete]")
eval(parse(text=activation.text.c), envir = parent.frame())
eval(parse(text=activation.text.c))
}

#Outcome vector and index factors now all reduced to complete cases only


#convert INDEX.names format from transmittable to actionable form (a list of vectors)
INDEX.names.list<-paste0("list(",INDEX.names.transmit,")")
INDEX<-eval(parse(text=INDEX.names.list), envir = parent.frame())

INDEX<-eval(parse(text=INDEX.names.list))
##################
#disclosure traps#
##################
N.count <- tapply(X.complete,INDEX,base::length)


N.count <- tapply(X.complete,INDEX,base::length)

if(min(N.count)<nfilter.tab && min(N.count) > 0){
return.message<-"ERROR: at least one group defined by INDEX has < nfilter.tab members. The output cannot therefore be returned to the clientside. But the function ds.tapply.assign may still be used to write the output to the data servers with no clientside return"
return(return.message)
Expand All @@ -125,8 +127,8 @@ for(k in 1:num.factors){

factor1.levels <- NA
activation.text.e<-paste0("factor1.levels<-levels(",INDEX.factors[1],")")
eval(parse(text=activation.text.e), envir = parent.frame())

eval(parse(text=activation.text.e))
factor1.level.names<-factor1.levels

for(u in 1:length(factor1.levels)){
Expand All @@ -140,11 +142,11 @@ for(k in 1:num.factors){

factor1.levels <- NA
activation.text.f<-paste0("factor1.levels<-levels(",INDEX.factors[1],")")
eval(parse(text=activation.text.f), envir = parent.frame())
eval(parse(text=activation.text.f))

factor2.levels <- NA
activation.text.g<-paste0("factor2.levels<-levels(",INDEX.factors[2],")")
eval(parse(text=activation.text.g), envir = parent.frame())
eval(parse(text=activation.text.g))

factor1.level.names<-factor1.levels

Expand Down Expand Up @@ -182,7 +184,7 @@ for(k in 1:num.factors){

factor1.levels <- NA
activation.text.e<-paste0("factor1.levels<-levels(",INDEX.factors[1],")")
eval(parse(text=activation.text.e), envir = parent.frame())
eval(parse(text=activation.text.e))

factor1.level.names<-factor1.levels

Expand All @@ -197,11 +199,11 @@ for(k in 1:num.factors){

factor1.levels <- NA
activation.text.f<-paste0("factor1.levels<-levels(",INDEX.factors[1],")")
eval(parse(text=activation.text.f), envir = parent.frame())
eval(parse(text=activation.text.f))

factor2.levels <- NA
activation.text.g<-paste0("factor2.levels<-levels(",INDEX.factors[2],")")
eval(parse(text=activation.text.g), envir = parent.frame())
eval(parse(text=activation.text.g))

factor1.level.names<-factor1.levels

Expand Down Expand Up @@ -239,7 +241,7 @@ for(k in 1:num.factors){

factor1.levels <- NA
activation.text.e<-paste0("factor1.levels<-levels(",INDEX.factors[1],")")
eval(parse(text=activation.text.e), envir = parent.frame())
eval(parse(text=activation.text.e))

factor1.level.names<-factor1.levels

Expand All @@ -254,11 +256,11 @@ for(k in 1:num.factors){

factor1.levels <- NA
activation.text.f<-paste0("factor1.levels<-levels(",INDEX.factors[1],")")
eval(parse(text=activation.text.f), envir = parent.frame())
eval(parse(text=activation.text.f))

factor2.levels <- NA
activation.text.g<-paste0("factor2.levels<-levels(",INDEX.factors[2],")")
eval(parse(text=activation.text.g), envir = parent.frame())
eval(parse(text=activation.text.g))

factor1.level.names<-factor1.levels

Expand Down
9 changes: 2 additions & 7 deletions man/BooleDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions man/asFactorDS2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions man/dataFrameDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions man/dataFrameSortDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions man/dataFrameSubsetDS1.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions man/dataFrameSubsetDS2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions man/densityGridDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions man/lexisDS2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/matrixDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions man/mergeDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions man/reShapeDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions man/recodeValuesDS1.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions man/recodeValuesDS2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 3 additions & 11 deletions man/repDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions man/seqDS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading