diff --git a/DESCRIPTION b/DESCRIPTION index 894d4ad..586383a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: dsStatsClient Maintainer: Author: -Version: 3.0.1 +Version: 4.0.0 License: GPL-3 Title: DataSHIELD client site stattistical functions Description: DataSHIELD client site stattistical functions diff --git a/R/ds.cor.R b/R/ds.cor.R index 56c1c55..852de32 100644 --- a/R/ds.cor.R +++ b/R/ds.cor.R @@ -1,5 +1,5 @@ #' -#' @title Computes the correlation between two or more vectors +#' @title Computes correlation between two or more vectors #' @description This is similar to the R base function 'cor'. #' @details In addition to computing correlations this function, unlike #' the R base function 'cor', produces a table outlining the number of complete cases @@ -19,54 +19,39 @@ #' @export #' @examples { #' -#' # load that contains the login details -#' data(logindata) +#' # load that contains the login details +#' data(logindata) #' -#' # login and assign specific variable(s) -#' # (by default the assigned dataset is a dataframe named 'D') -#' myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER') -#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) +#' # login and assign specific variable(s) +#' # (by default the assigned dataset is a dataframe named 'D') +#' myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER') +#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) #' -#' # Example 1: generate the correlation matrix for the assigned dataset 'D' -#' # which contains 4 vectors (2 continuous and 1 categorical) -#' ds.cor(x='D') +#' # Example 1: generate the correlation matrix for the assigned dataset 'D' +#' # which contains 4 vectors (2 continuous and 1 categorical) +#' ds.cor(x='D') #' -#' # Example 2: calculate the correlation between two vectors (first assign some vectors from the dataframe 'D') -#' ds.assign(newobj='labhdl', toAssign='D$LAB_HDL') -#' ds.assign(newobj='labtsc', toAssign='D$LAB_TSC') -#' ds.assign(newobj='gender', toAssign='D$GENDER') -#' ds.cor(x='labhdl', y='labtsc') -#' ds.cor(x='labhdl', y='gender') +#' # Example 2: calculate the correlation between two vectors (first assign some vectors from the dataframe 'D') +#' ds.assign(newobj='labhdl', toAssign='D$LAB_HDL') +#' ds.assign(newobj='labtsc', toAssign='D$LAB_TSC') +#' ds.assign(newobj='gender', toAssign='D$GENDER') +#' ds.cor(x='labhdl', y='labtsc') +#' ds.cor(x='labhdl', y='gender') #' -#' # clear the Datashield R sessions and logout -#' datashield.logout(opals) +#' # clear the Datashield R sessions and logout +#' datashield.logout(opals) #' #' } #' -ds.cor = function(x=NULL, y=NULL, naAction='pairwise.complete.obs', datasources=NULL) -{ +ds.cor = function(x=NULL, y=NULL, naAction='pairwise.complete.obs', datasources=NULL){ - # if no opal login details were provided look for 'opal' objects in the environment + # if no opal login details are provided look for 'opal' objects in the environment if(is.null(datasources)){ - findLogin <- getOpals() - if(findLogin$flag == 1){ - datasources <- findLogin$opals - }else{ - if(findLogin$flag == 0){ - stop(" Are yout logged in to any server? Please provide a valid opal login object! ", call.=FALSE) - }else{ - message(paste0("More than one list of opal login object were found: '", paste(findLogin$opals,collapse="', '"), "'!")) - userInput <- readline("Please enter the name of the login object you want to use: ") - datasources <- eval(parse(text=userInput)) - if(class(datasources[[1]]) != 'opal'){ - stop("End of process: you failed to enter a valid login object", call.=FALSE) - } - } - } + datasources <- findLoginObjects() } if(is.null(x)){ - stop("x=NULL. Please provide the names of two numeric vectors!", call.=FALSE) + stop("x must be the name of a numeric vector or a table structure (matrix or data frame)", call.=FALSE) }else{ defined <- isDefined(datasources, x) } @@ -76,9 +61,7 @@ ds.cor = function(x=NULL, y=NULL, naAction='pairwise.complete.obs', datasources= if(typ=='numeric' | typ=='integer' | typ=='factor'){ if(is.null(y)){ - message(" ALERT!") - message(" y is set to NULL whilst x is a numeric vector, please provide a second vector") - stop(" End of process!", call.=FALSE) + stop("If x is a numeric vector, y must be a numeric vector!", call.=FALSE) }else{ defined2 <- isDefined(datasources, y) typ2 <- checkClass(datasources, y) @@ -87,7 +70,7 @@ ds.cor = function(x=NULL, y=NULL, naAction='pairwise.complete.obs', datasources= if(typ=='matrix' | typ=='data.frame' & !(is.null(y))){ y <- NULL - warning(" x is a matrix or a dataframe; y will be ignored and a correlation matrix computed for x!") + warning("x is a matrix or a data frame; y will be ignored and a correlation matrix computed for x!") } # name of the studies to be used in the output diff --git a/R/ds.corTest.R b/R/ds.corTest.R index 02977fc..7f982e9 100644 --- a/R/ds.corTest.R +++ b/R/ds.corTest.R @@ -11,48 +11,34 @@ #' @export #' @examples { #' -#' # load that contains the login details -#' data(logindata) +#' # load that contains the login details +#' data(logindata) #' -#' # login and assign specific variable(s) -#' # (by default the assigned dataset is a dataframe named 'D') -#' myvar <- list('LAB_TSC', 'LAB_HDL') -#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) +#' # login and assign specific variable(s) +#' # (by default the assigned dataset is a dataframe named 'D') +#' myvar <- list('LAB_TSC', 'LAB_HDL') +#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) #' -#' # test for correlation between the variables 'LAB_TSC' and 'LAB_HDL' -#' ds.corTest(x='D$LAB_TSC', y='D$LAB_HDL') +#' # test for correlation between the variables 'LAB_TSC' and 'LAB_HDL' +#' ds.corTest(x='D$LAB_TSC', y='D$LAB_HDL') #' -#' # clear the Datashield R sessions and logout -#' datashield.logout(opals) +#' # clear the Datashield R sessions and logout +#' datashield.logout(opals) #' #' } #' ds.corTest = function(x=NULL, y=NULL, datasources=NULL){ - # if no opal login details were provided look for 'opal' objects in the environment + # if no opal login details are provided look for 'opal' objects in the environment if(is.null(datasources)){ - findLogin <- getOpals() - if(findLogin$flag == 1){ - datasources <- findLogin$opals - }else{ - if(findLogin$flag == 0){ - stop(" Are yout logged in to any server? Please provide a valid opal login object! ", call.=FALSE) - }else{ - message(paste0("More than one list of opal login object were found: '", paste(findLogin$opals,collapse="', '"), "'!")) - userInput <- readline("Please enter the name of the login object you want to use: ") - datasources <- eval(parse(text=userInput)) - if(class(datasources[[1]]) != 'opal'){ - stop("End of process: you failed to enter a valid login object", call.=FALSE) - } - } - } + datasources <- findLoginObjects() } if(is.null(x)){ - stop("x=NULL. Please provide the names of two numeric vectors!", call.=FALSE) + stop("x=NULL. Please provide the names of the 1st vector!", call.=FALSE) } if(is.null(y)){ - stop("y=NULL. Please provide the names of two numeric vectors!", call.=FALSE) + stop("y=NULL. Please provide the names of the 2nd numeric vector!", call.=FALSE) } # the input variable might be given as column table (i.e. D$object) diff --git a/R/ds.cov.R b/R/ds.cov.R index 16cc8c3..15605b1 100644 --- a/R/ds.cov.R +++ b/R/ds.cov.R @@ -19,50 +19,36 @@ #' @export #' @examples { #' -#' # load that contains the login details -#' data(logindata) +#' # load that contains the login details +#' data(logindata) #' -#' # login and assign specific variable(s) -#' # (by default the assigned dataset is a dataframe named 'D') -#' myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER') -#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) +#' # login and assign specific variable(s) +#' # (by default the assigned dataset is a dataframe named 'D') +#' myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER') +#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) #' -#' # Example 1: generate the covariance matrix for the assigned dataset 'D' -#' # which contains 4 vectors (2 continuous and 1 categorical) -#' ds.cov(x='D') +#' # Example 1: generate the covariance matrix for the assigned dataset 'D' +#' # which contains 4 vectors (2 continuous and 1 categorical) +#' ds.cov(x='D') #' -#' # Example 2: calculate the covariance between two vectors -#' # (first assign the vectors from 'D') -#' ds.assign(newobj='labhdl', toAssign='D$LAB_HDL') -#' ds.assign(newobj='labtsc', toAssign='D$LAB_TSC') -#' ds.assign(newobj='gender', toAssign='D$GENDER') -#' ds.cov(x='labhdl', y='labtsc') -#' ds.cov(x='labhdl', y='gender') +#' # Example 2: calculate the covariance between two vectors +#' # (first assign the vectors from 'D') +#' ds.assign(newobj='labhdl', toAssign='D$LAB_HDL') +#' ds.assign(newobj='labtsc', toAssign='D$LAB_TSC') +#' ds.assign(newobj='gender', toAssign='D$GENDER') +#' ds.cov(x='labhdl', y='labtsc') +#' ds.cov(x='labhdl', y='gender') #' -#' # clear the Datashield R sessions and logout -#' datashield.logout(opals) +#' # clear the Datashield R sessions and logout +#' datashield.logout(opals) #' #' } #' ds.cov = function(x=NULL, y=NULL, naAction='pairwise.complete.obs', datasources=NULL){ - # if no opal login details were provided look for 'opal' objects in the environment + # if no opal login details are provided look for 'opal' objects in the environment if(is.null(datasources)){ - findLogin <- getOpals() - if(findLogin$flag == 1){ - datasources <- findLogin$opals - }else{ - if(findLogin$flag == 0){ - stop(" Are yout logged in to any server? Please provide a valid opal login object! ", call.=FALSE) - }else{ - message(paste0("More than one list of opal login object were found: '", paste(findLogin$opals,collapse="', '"), "'!")) - userInput <- readline("Please enter the name of the login object you want to use: ") - datasources <- eval(parse(text=userInput)) - if(class(datasources[[1]]) != 'opal'){ - stop("End of process: you failed to enter a valid login object", call.=FALSE) - } - } - } + datasources <- findLoginObjects() } if(is.null(x)){ @@ -76,9 +62,7 @@ ds.cov = function(x=NULL, y=NULL, naAction='pairwise.complete.obs', datasources= if(typ=='numeric' | typ=='integer' | typ=='factor'){ if(is.null(y)){ - message(" ALERT!") - message(" y is set to NULL whilst x is a numeric vector, please provide a second vector") - stop(" End of process!", call.=FALSE) + stop("If x is a numeric vector, y must be a numeric vector!", call.=FALSE) }else{ defined2 <- isDefined(datasources, y) typ2 <- checkClass(datasources, y) @@ -87,7 +71,7 @@ ds.cov = function(x=NULL, y=NULL, naAction='pairwise.complete.obs', datasources= if(typ=='matrix' | typ=='data.frame' & !(is.null(y))){ y <- NULL - warning(" x is a matrix or a dataframe; y will be ignored and a covariance matrix computed for x!") + warning("x is a matrix or a dataframe; y will be ignored and a covariance matrix computed for x!") } # name of the studies to be used in the output diff --git a/R/ds.tTest.R b/R/ds.tTest.R index 51aa989..aebc174 100644 --- a/R/ds.tTest.R +++ b/R/ds.tTest.R @@ -21,80 +21,67 @@ #' @param datasources a list of opal object(s) obtained after login in to opal servers; #' these objects hold also the data assign to R, as \code{dataframe}, from opal datasources. #' @return a list containing the following elements: -#' \code{statistic} the value of the t-statistic -#' \code{parameter} the degrees of freedom for the t-statistic -#' \code{p.value} p.value the p-value for the test -#' \code{conf.int} a confidence interval for the mean appropriate to the specified alternative hypothesis -#' \code{estimate} the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test -#' \code{null.value} the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample test or a two-sample test +#' \code{statistic} the value of the t-statistic. +#' \code{parameter} the degrees of freedom for the t-statistic. +#' \code{p.value} p.value the p-value for the test. +#' \code{conf.int} a confidence interval for the mean appropriate to the specified alternative hypothesis. +#' \code{estimate} the estimated mean or difference in means depending on whether it was a one-sample test +#' or a two-sample test. +#' \code{null.value} the specified hypothesized value of the mean or mean difference depending on whether it +#' was a one-sample test or a two-sample test. #' \code{alternative} a character string describing the alternative hypothesis #' \code{method} a character string indicating what type of t-test was performed #' @author Isaeva, J.; Gaye, A. #' @export -#' @examples -#' { +#' @examples { #' -#' # load that contains the login details -#' data(logindata) +#' # load that contains the login details +#' data(logindata) #' -#' # login and assign specific variable(s) -#' myvar <- list("LAB_HDL", "LAB_TSC") -#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) +#' # login and assign specific variable(s) +#' myvar <- list("LAB_HDL", "LAB_TSC") +#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) #' -#' # Example 1: Run a t.test of the pooled data for the variables 'LAB_HDL' and 'LAB_TSC' - default -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC') +#' # Example 1: Run a t.test of the pooled data for the variables 'LAB_HDL' and 'LAB_TSC' - default +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC') #' -#' # Example 2: Run a t.test for each study separately for the same variables as above -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', type='split') +#' # Example 2: Run a t.test for each study separately for the same variables as above +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', type='split') #' -#' # Example 3: Run a paired t.test of the pooled data -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', paired=TRUE) +#' # Example 3: Run a paired t.test of the pooled data +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', paired=TRUE) #' -#' # Example 4: Run a paired t.test for each study separately -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', paired=TRUE, type='split') +#' # Example 4: Run a paired t.test for each study separately +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', paired=TRUE, type='split') #' -#' # Example 5: Run a t.test of the pooled data with different alternatives -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', alternative='greater') -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', alternative='less') +#' # Example 5: Run a t.test of the pooled data with different alternatives +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', alternative='greater') +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', alternative='less') #' -#' # Example 6: Run a t.test of the pooled data with mu different from zero -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', mu=-4) +#' # Example 6: Run a t.test of the pooled data with mu different from zero +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', mu=-4) #' -#' # Example 7: Run a t.test of the pooled data assuming that variances of variables are equal -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', var.equal=TRUE) +#' # Example 7: Run a t.test of the pooled data assuming that variances of variables are equal +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', var.equal=TRUE) #' -#' # Example 8: Run a t.test of the pooled data with 90% confidence interval -#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', conf.level=0.90) +#' # Example 8: Run a t.test of the pooled data with 90% confidence interval +#' ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', conf.level=0.90) #' -#' # Example 9: Run a one-sample t.test of the pooled data -#' ds.tTest(x='D$LAB_HDL') -#' # the below example should not work, paired t.test is not possible if the 'y' variable is missing -#' # ds.tTest(x='D$LAB_HDL', paired=TRUE) +#' # Example 9: Run a one-sample t.test of the pooled data +#' ds.tTest(x='D$LAB_HDL') +#' # the below example should not work, paired t.test is not possible if the 'y' variable is missing +#' # ds.tTest(x='D$LAB_HDL', paired=TRUE) #' -#' # clear the Datashield R sessions and logout -#' datashield.logout(opals) +#' # clear the Datashield R sessions and logout +#' datashield.logout(opals) #' #'} #' ds.tTest <- function (x=NULL, y=NULL, type="combine", alternative="two.sided", mu=0, paired=FALSE, var.equal=FALSE, conf.level=0.95, datasources=NULL) { - # if no opal login details were provided look for 'opal' objects in the environment + # if no opal login details are provided look for 'opal' objects in the environment if(is.null(datasources)){ - findLogin <- getOpals() - if(findLogin$flag == 1){ - datasources <- findLogin$opals - }else{ - if(findLogin$flag == 0){ - stop(" Are yout logged in to any server? Please provide a valid opal login object! ", call.=FALSE) - }else{ - message(paste0("More than one list of opal login object were found: '", paste(findLogin$opals,collapse="', '"), "'!")) - userInput <- readline("Please enter the name of the login object you want to use: ") - datasources <- eval(parse(text=userInput)) - if(class(datasources[[1]]) != 'opal'){ - stop("End of process: you failed to enter a valid login object", call.=FALSE) - } - } - } + datasources <- findLoginObjects() } if(is.null(x)){ @@ -187,9 +174,8 @@ ds.tTest <- function (x=NULL, y=NULL, type="combine", alternative="two.sided", m cally = paste0("subsetDS('", x, "', not.na.x)") datashield.assign(datasources, 'xok', as.symbol(cally)) cally = paste0("as.null(", x, ")") - datashield.assign(datasources, 'yok', as.symbol(cally)) # does not matter that as.null(x) since we just want to make y to be NULL - } - + datashield.assign(datasources, 'yok', as.symbol(cally)) # does not matter that as.null(x) since we just want to set y to NULL + } if (paired) { cally = paste0("(yok)","*(",-1,")") diff --git a/R/ds.var.R b/R/ds.var.R index 4d8fd83..90c093a 100644 --- a/R/ds.var.R +++ b/R/ds.var.R @@ -13,43 +13,29 @@ #' @export #' @examples { #' -#' # load that contains the login details -#' data(logindata) +#' # load that contains the login details +#' data(logindata) #' -#' # login and assign specific variable(s) -#' myvar <- list('LAB_TSC') -#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) +#' # login and assign specific variable(s) +#' myvar <- list('LAB_TSC') +#' opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) #' -#' # Example 1: compute the pooled variance of the variable 'LAB_TSC' - default behaviour -#' ds.var(x='D$LAB_TSC') +#' # Example 1: compute the pooled variance of the variable 'LAB_TSC' - default behaviour +#' ds.var(x='D$LAB_TSC') #' -#' # Example 2: compute the variance of each study separately -#' ds.var(x='D$LAB_TSC', type='split') +#' # Example 2: compute the variance of each study separately +#' ds.var(x='D$LAB_TSC', type='split') #' -#' # clear the Datashield R sessions and logout -#' datashield.logout(opals) +#' # clear the Datashield R sessions and logout +#' datashield.logout(opals) #' #' } #' ds.var = function(x=NULL, type='combine', datasources=NULL){ - # if no opal login details were provided look for 'opal' objects in the environment + # if no opal login details are provided look for 'opal' objects in the environment if(is.null(datasources)){ - findLogin <- getOpals() - if(findLogin$flag == 1){ - datasources <- findLogin$opals - }else{ - if(findLogin$flag == 0){ - stop(" Are yout logged in to any server? Please provide a valid opal login object! ", call.=FALSE) - }else{ - message(paste0("More than one list of opal login object were found: '", paste(findLogin$opals,collapse="', '"), "'!")) - userInput <- readline("Please enter the name of the login object you want to use: ") - datasources <- eval(parse(text=userInput)) - if(class(datasources[[1]]) != 'opal'){ - stop("End of process: you failed to enter a valid login object", call.=FALSE) - } - } - } + datasources <- findLoginObjects() } if(is.null(x)){ diff --git a/data/login_remoteServer.rda b/data/login_remoteServer.rda index 7720b6a..721c514 100644 Binary files a/data/login_remoteServer.rda and b/data/login_remoteServer.rda differ diff --git a/man/ds.cor.Rd b/man/ds.cor.Rd index 4540fd2..9264cb3 100644 --- a/man/ds.cor.Rd +++ b/man/ds.cor.Rd @@ -1,6 +1,6 @@ \name{ds.cor} \alias{ds.cor} -\title{Computes the correlation between two or more vectors} +\title{Computes correlation between two or more vectors} \usage{ ds.cor(x = NULL, y = NULL, naAction = "pairwise.complete.obs", datasources = NULL) @@ -43,27 +43,27 @@ calculations. \examples{ { -# load that contains the login details -data(logindata) + # load that contains the login details + data(logindata) -# login and assign specific variable(s) -# (by default the assigned dataset is a dataframe named 'D') -myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER') -opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) + # login and assign specific variable(s) + # (by default the assigned dataset is a dataframe named 'D') + myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER') + opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) -# Example 1: generate the correlation matrix for the assigned dataset 'D' -# which contains 4 vectors (2 continuous and 1 categorical) -ds.cor(x='D') + # Example 1: generate the correlation matrix for the assigned dataset 'D' + # which contains 4 vectors (2 continuous and 1 categorical) + ds.cor(x='D') -# Example 2: calculate the correlation between two vectors (first assign some vectors from the dataframe 'D') -ds.assign(newobj='labhdl', toAssign='D$LAB_HDL') -ds.assign(newobj='labtsc', toAssign='D$LAB_TSC') -ds.assign(newobj='gender', toAssign='D$GENDER') -ds.cor(x='labhdl', y='labtsc') -ds.cor(x='labhdl', y='gender') + # Example 2: calculate the correlation between two vectors (first assign some vectors from the dataframe 'D') + ds.assign(newobj='labhdl', toAssign='D$LAB_HDL') + ds.assign(newobj='labtsc', toAssign='D$LAB_TSC') + ds.assign(newobj='gender', toAssign='D$GENDER') + ds.cor(x='labhdl', y='labtsc') + ds.cor(x='labhdl', y='gender') -# clear the Datashield R sessions and logout -datashield.logout(opals) + # clear the Datashield R sessions and logout + datashield.logout(opals) } } diff --git a/man/ds.corTest.Rd b/man/ds.corTest.Rd index c477501..8f4d0fd 100644 --- a/man/ds.corTest.Rd +++ b/man/ds.corTest.Rd @@ -28,19 +28,19 @@ Runs a two sided pearson test with a 0.95 confidence level. \examples{ { -# load that contains the login details -data(logindata) + # load that contains the login details + data(logindata) -# login and assign specific variable(s) -# (by default the assigned dataset is a dataframe named 'D') -myvar <- list('LAB_TSC', 'LAB_HDL') -opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) + # login and assign specific variable(s) + # (by default the assigned dataset is a dataframe named 'D') + myvar <- list('LAB_TSC', 'LAB_HDL') + opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) -# test for correlation between the variables 'LAB_TSC' and 'LAB_HDL' -ds.corTest(x='D$LAB_TSC', y='D$LAB_HDL') + # test for correlation between the variables 'LAB_TSC' and 'LAB_HDL' + ds.corTest(x='D$LAB_TSC', y='D$LAB_HDL') -# clear the Datashield R sessions and logout -datashield.logout(opals) + # clear the Datashield R sessions and logout + datashield.logout(opals) } } diff --git a/man/ds.cov.Rd b/man/ds.cov.Rd index 055ee95..01a5570 100644 --- a/man/ds.cov.Rd +++ b/man/ds.cov.Rd @@ -43,28 +43,28 @@ calculations. \examples{ { -# load that contains the login details -data(logindata) + # load that contains the login details + data(logindata) -# login and assign specific variable(s) -# (by default the assigned dataset is a dataframe named 'D') -myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER') -opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) + # login and assign specific variable(s) + # (by default the assigned dataset is a dataframe named 'D') + myvar <- list('LAB_HDL', 'LAB_TSC', 'GENDER') + opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) -# Example 1: generate the covariance matrix for the assigned dataset 'D' -# which contains 4 vectors (2 continuous and 1 categorical) -ds.cov(x='D') + # Example 1: generate the covariance matrix for the assigned dataset 'D' + # which contains 4 vectors (2 continuous and 1 categorical) + ds.cov(x='D') -# Example 2: calculate the covariance between two vectors -# (first assign the vectors from 'D') -ds.assign(newobj='labhdl', toAssign='D$LAB_HDL') -ds.assign(newobj='labtsc', toAssign='D$LAB_TSC') -ds.assign(newobj='gender', toAssign='D$GENDER') -ds.cov(x='labhdl', y='labtsc') -ds.cov(x='labhdl', y='gender') + # Example 2: calculate the covariance between two vectors + # (first assign the vectors from 'D') + ds.assign(newobj='labhdl', toAssign='D$LAB_HDL') + ds.assign(newobj='labtsc', toAssign='D$LAB_TSC') + ds.assign(newobj='gender', toAssign='D$GENDER') + ds.cov(x='labhdl', y='labtsc') + ds.cov(x='labhdl', y='gender') -# clear the Datashield R sessions and logout -datashield.logout(opals) + # clear the Datashield R sessions and logout + datashield.logout(opals) } } diff --git a/man/ds.tTest.Rd b/man/ds.tTest.Rd index 8729b66..6ac6f59 100644 --- a/man/ds.tTest.Rd +++ b/man/ds.tTest.Rd @@ -46,18 +46,19 @@ ds.tTest(x = NULL, y = NULL, type = "combine", } \value{ a list containing the following elements: \code{statistic} -the value of the t-statistic \code{parameter} the degrees -of freedom for the t-statistic \code{p.value} p.value the -p-value for the test \code{conf.int} a confidence interval +the value of the t-statistic. \code{parameter} the degrees +of freedom for the t-statistic. \code{p.value} p.value the +p-value for the test. \code{conf.int} a confidence interval for the mean appropriate to the specified alternative -hypothesis \code{estimate} the estimated mean or difference -in means depending on whether it was a one-sample test or a -two-sample test \code{null.value} the specified -hypothesized value of the mean or mean difference depending -on whether it was a one-sample test or a two-sample test -\code{alternative} a character string describing the -alternative hypothesis \code{method} a character string -indicating what type of t-test was performed +hypothesis. \code{estimate} the estimated mean or +difference in means depending on whether it was a +one-sample test or a two-sample test. \code{null.value} the +specified hypothesized value of the mean or mean difference +depending on whether it was a one-sample test or a +two-sample test. \code{alternative} a character string +describing the alternative hypothesis \code{method} a +character string indicating what type of t-test was +performed } \description{ Performs one and two sample t-tests on vectors of data. @@ -73,45 +74,45 @@ used for performing t-test. \examples{ { -# load that contains the login details -data(logindata) + # load that contains the login details + data(logindata) -# login and assign specific variable(s) -myvar <- list("LAB_HDL", "LAB_TSC") -opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) + # login and assign specific variable(s) + myvar <- list("LAB_HDL", "LAB_TSC") + opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) -# Example 1: Run a t.test of the pooled data for the variables 'LAB_HDL' and 'LAB_TSC' - default -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC') + # Example 1: Run a t.test of the pooled data for the variables 'LAB_HDL' and 'LAB_TSC' - default + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC') -# Example 2: Run a t.test for each study separately for the same variables as above -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', type='split') + # Example 2: Run a t.test for each study separately for the same variables as above + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', type='split') -# Example 3: Run a paired t.test of the pooled data -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', paired=TRUE) + # Example 3: Run a paired t.test of the pooled data + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', paired=TRUE) -# Example 4: Run a paired t.test for each study separately -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', paired=TRUE, type='split') + # Example 4: Run a paired t.test for each study separately + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', paired=TRUE, type='split') -# Example 5: Run a t.test of the pooled data with different alternatives -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', alternative='greater') -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', alternative='less') + # Example 5: Run a t.test of the pooled data with different alternatives + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', alternative='greater') + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', alternative='less') -# Example 6: Run a t.test of the pooled data with mu different from zero -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', mu=-4) + # Example 6: Run a t.test of the pooled data with mu different from zero + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', mu=-4) -# Example 7: Run a t.test of the pooled data assuming that variances of variables are equal -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', var.equal=TRUE) + # Example 7: Run a t.test of the pooled data assuming that variances of variables are equal + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', var.equal=TRUE) -# Example 8: Run a t.test of the pooled data with 90\% confidence interval -ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', conf.level=0.90) + # Example 8: Run a t.test of the pooled data with 90\% confidence interval + ds.tTest(x='D$LAB_HDL', y='D$LAB_TSC', conf.level=0.90) -# Example 9: Run a one-sample t.test of the pooled data -ds.tTest(x='D$LAB_HDL') -# the below example should not work, paired t.test is not possible if the 'y' variable is missing -# ds.tTest(x='D$LAB_HDL', paired=TRUE) + # Example 9: Run a one-sample t.test of the pooled data + ds.tTest(x='D$LAB_HDL') + # the below example should not work, paired t.test is not possible if the 'y' variable is missing + # ds.tTest(x='D$LAB_HDL', paired=TRUE) -# clear the Datashield R sessions and logout -datashield.logout(opals) + # clear the Datashield R sessions and logout + datashield.logout(opals) } } diff --git a/man/ds.var.Rd b/man/ds.var.Rd index 192be6c..2f149c3 100644 --- a/man/ds.var.Rd +++ b/man/ds.var.Rd @@ -32,21 +32,21 @@ It is a wrapper for the server side function \examples{ { -# load that contains the login details -data(logindata) + # load that contains the login details + data(logindata) -# login and assign specific variable(s) -myvar <- list('LAB_TSC') -opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) + # login and assign specific variable(s) + myvar <- list('LAB_TSC') + opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar) -# Example 1: compute the pooled variance of the variable 'LAB_TSC' - default behaviour -ds.var(x='D$LAB_TSC') + # Example 1: compute the pooled variance of the variable 'LAB_TSC' - default behaviour + ds.var(x='D$LAB_TSC') -# Example 2: compute the variance of each study separately -ds.var(x='D$LAB_TSC', type='split') + # Example 2: compute the variance of each study separately + ds.var(x='D$LAB_TSC', type='split') -# clear the Datashield R sessions and logout -datashield.logout(opals) + # clear the Datashield R sessions and logout + datashield.logout(opals) } } diff --git a/man/findLoginObjects.Rd b/man/findLoginObjects.Rd new file mode 100644 index 0000000..5062bb3 --- /dev/null +++ b/man/findLoginObjects.Rd @@ -0,0 +1,26 @@ +\name{findLoginObjects} +\alias{findLoginObjects} +\title{searches for opal login object in the environment} +\usage{ +findLoginObjects() +} +\value{ +returns a list of opal login objects or stops the process +} +\description{ +This is an internal function required by a client function +} +\details{ + + +if the user does not set the argument 'datasources', this +function is called to searches for opal login objects in +the environment. If more than one login object is found a +prompt asks the user to choose one and if none is found the +process stops. +} +\author{ +Gaye, A. +} +\keyword{internal} + diff --git a/man/login_remoteServer.Rd b/man/login_remoteServer.Rd index 2b2b7be..6bb3c96 100755 --- a/man/login_remoteServer.Rd +++ b/man/login_remoteServer.Rd @@ -1,16 +1,16 @@ -\name{logindata} +\name{login_remoteServer} -\alias{logindata} +\alias{login_remoteServer} \docType{data} -\title{Information required to login to opal servers for the GLM test data} +\title{Information required to login to opal servers} \description{ A table of with 5 columns: study name, URL, username, password and opal datasource. } -\usage{data(logindata)} +\usage{data(login_remoteServer)} \format{ A data frame where the number of servers corresponds to the number of rows @@ -26,4 +26,4 @@ } } -\examples{data(logindata)} +\examples{data(login_remoteServer)}