Skip to content

Commit 57ae658

Browse files
authored
Merge pull request #34 from datashield/v6.4.0-dev
V6.4.0 dev
2 parents e16c6da + 3ea7406 commit 57ae658

14 files changed

Lines changed: 133 additions & 624 deletions

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ AssignMethods:
164164
seqDS,
165165
sqrtDS,
166166
subsetByClassDS,
167-
subsetDS,
168167
tableDS.assign,
169168
tapplyDS.assign,
170169
uniqueDS,

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ export(skewnessDS1)
125125
export(skewnessDS2)
126126
export(sqrtDS)
127127
export(subsetByClassDS)
128-
export(subsetDS)
129128
export(table1DDS)
130129
export(table2DDS)
131130
export(tableDS)

R/asCharacterDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#'
1515
asCharacterDS <- function (x.name){
1616

17-
x<-eval(parse(text=x.name), envir = parent.frame())
17+
x <- eval(parse(text=x.name), envir = parent.frame())
1818

1919
output <- as.character(x)
2020
return(output)

R/asDataMatrixDS.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#'
12
#' @title asDataMatrixDS a serverside assign function called by ds.asDataMatrix
23
#' @description Coerces an R object into a matrix maintaining original
34
#' class for all columns in data.frames.
@@ -16,15 +17,16 @@
1617
#' details see help on the clientside function \code{ds.asDataMatrix}
1718
#' @author Paul Burton for DataSHIELD Development Team
1819
#' @export
20+
#'
1921
asDataMatrixDS <- function (x.name){
2022

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

2426
}else{
2527
studysideMessage<-"ERROR: x.name must be specified as a character string"
2628
stop(studysideMessage, call. = FALSE)
27-
}
29+
}
2830

2931
output <- data.matrix(x)
3032

R/asFactorDS1.R

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#' @export
1111
#'
1212
asFactorDS1 <- function(input.var.name=NULL){
13+
1314
##################################################################
1415
#MODULE 1: CAPTURE THE nfilter SETTINGS #
1516
thr<-dsBase::listDisclosureSettingsDS() #
@@ -26,27 +27,29 @@ asFactorDS1 <- function(input.var.name=NULL){
2627

2728
input.var <- eval(parse(text=input.var.name), envir = parent.frame())
2829
factor.levels.present.in.source <- levels(factor(input.var))
29-
num.levels<-length(factor.levels.present.in.source)
30+
num.levels <- length(factor.levels.present.in.source)
3031

3132
max.levels.by.density<-nfilter.levels.density*length(input.var)
3233

33-
if(num.levels>nfilter.levels.max)
34-
{
35-
error.message<-
36-
paste0("FAILED: this variable has too many levels and may be disclosive. It exceeds the max number of levels allowed by nfilter.levels.max: that is ",nfilter.levels.max,". In this study this variable has ",num.levels," factor levels")
34+
if(num.levels > nfilter.levels.max){
35+
error.message <- paste0("FAILED: this variable has too many levels and may be disclosive.
36+
It exceeds the max number of levels allowed by nfilter.levels.max:
37+
that is ", nfilter.levels.max, ". In this study this variable has ",
38+
num.levels," factor levels")
3739
stop(error.message, call. = FALSE)
3840
}
3941

40-
if(num.levels>(length(input.var)*nfilter.levels.density))
41-
{
42-
error.message<-
43-
paste0("FAILED: this variable has too many levels and may be disclosive. The number of factor levels must not exceed ", (nfilter.levels.density*100), "% of the length of the variable being converted to a factor. The max number of levels in this study is therefore ",max.levels.by.density," but this variable has ",num.levels," factor levels")
42+
if(num.levels > (length(input.var)*nfilter.levels.density)){
43+
error.message <- paste0("FAILED: this variable has too many levels and may be disclosive.
44+
The number of factor levels must not exceed ", (nfilter.levels.density*100),
45+
"% of the length of the variable being converted to a factor. The max number
46+
of levels in this study is therefore ",max.levels.by.density," but this
47+
variable has ", num.levels, " factor levels")
4448
stop(error.message, call. = FALSE)
4549
}
4650

4751
return(factor.levels.present.in.source)
4852

4953
}
50-
#AGGREGATE FUNCTION
54+
# AGGREGATE FUNCTION
5155
# asFactorDS1
52-

R/asListDS.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#'
12
#' @title asListDS a serverside aggregate function called by ds.asList
23
#' @description Coerces an R object into a list
34
#' @details Unlike most other class coercing functions this is
@@ -21,25 +22,26 @@
2122
#' the class of the output object should usually be 'list'
2223
#' @author Amadou Gaye, Paul Burton for DataSHIELD Development Team
2324
#' @export
25+
#'
2426
asListDS <- function (x.name, newobj){
2527

2628
newobj.class <- NULL
2729
if(is.character(x.name)){
28-
active.text<-paste0(newobj,"<-as.list(",x.name,")")
30+
active.text <- paste0(newobj,"<-as.list(",x.name,")")
2931
eval(parse(text=active.text), envir = parent.frame())
3032

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

3436
}else{
35-
studysideMessage<-"ERROR: x.name must be specified as a character string"
37+
studysideMessage <- "ERROR: x.name must be specified as a character string"
3638
stop(studysideMessage, call. = FALSE)
3739
}
3840

39-
return.message<-paste0("New object <",newobj,"> created")
40-
object.class.text<-paste0("Class of <",newobj,"> is '",newobj.class,"'")
41+
return.message <- paste0("New object <", newobj, "> created")
42+
object.class.text <- paste0("Class of <", newobj, "> is '", newobj.class, "'")
4143

42-
return(list(return.message=return.message,class.of.newobj=object.class.text))
44+
return(list(return.message=return.message, class.of.newobj=object.class.text))
4345
}
4446
# AGGEGATE FUNCTION
4547
# asListDS

R/asLogicalDS.R

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#'
12
#' @title Coerces an R object into class numeric
23
#' @description this function is based on the native R function \code{as.numeric}
34
#' @details See help for function \code{as.logical} in native R
@@ -10,24 +11,25 @@
1011
#' details see help on the clientside function \code{ds.asLogical}
1112
#' @author Amadou Gaye, Paul Burton for DataSHIELD Development Team
1213
#' @export
14+
#'
1315
asLogicalDS <- function (x.name){
1416

15-
if(is.character(x.name)){
16-
x<-eval(parse(text=x.name), envir = parent.frame())
17+
if(is.character(x.name)){
18+
x <- eval(parse(text=x.name), envir = parent.frame())
1719

1820
}else{
19-
studysideMessage<-"ERROR: x.name must be specified as a character string"
21+
studysideMessage <- "ERROR: x.name must be specified as a character string"
2022
stop(studysideMessage, call. = FALSE)
21-
}
23+
}
2224

23-
if(!is.numeric(x)&&!is.integer(x)&&!is.character(x)&&!is.matrix(x)){
24-
studysideMessage<-"ERROR: for ds.asLogical function, x.name must specify an input object of class numeric, integer, character or matrix"
25-
stop(studysideMessage, call. = FALSE)
25+
if(!is.numeric(x) && !is.integer(x) && !is.character(x) && !is.matrix(x)){
26+
studysideMessage <- "ERROR: for ds.asLogical function, x.name must specify an input object of class numeric, integer, character or matrix"
27+
stop(studysideMessage, call. = FALSE)
2628
}
2729

2830
output <- as.logical(x)
2931

3032
return(output)
3133
}
32-
#ASSIGN FUNCTION
34+
# ASSIGN FUNCTION
3335
# asLogicalDS

R/aucDS.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ aucDS <- function(pred=pred, y=y){
3131
q2 <- 2*AUC^2/(1+AUC)-AUC^2
3232
se <- sqrt((q0+(n0-1)*q1+(n1-1)*q2)/(n0*n1))
3333

34-
return(list(AUC=AUC,se=se))
34+
return(list(AUC=AUC, se=se))
3535

3636
}

R/minMaxRandDS.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#'
12
#' @title Secure ranking of "V2BR" (vector to be ranked) across all sources
23
#' @description Creates a minimum value that is more negative, and less positive
34
#' than any real value in V2BR and a maximum value that is more positive and
@@ -61,9 +62,5 @@ rand.min.max<-c(rand.min,rand.max)
6162
return(rand.min.max)
6263

6364
}
64-
#AGGREGATE
65+
# AGGREGATE
6566
# minMaxRandDS
66-
67-
68-
69-

R/subsetDS.R

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

0 commit comments

Comments
 (0)