diff --git a/NAMESPACE b/NAMESPACE index f53449f03..3a7b57893 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -19,9 +19,9 @@ export(ds.contourPlot) export(ds.cor) export(ds.corTest) export(ds.cov) +export(ds.dataFrame) export(ds.dataFrameSort) export(ds.dataFrameSubset) -export(ds.dataframe) export(ds.densityGrid) export(ds.dim) export(ds.exists) diff --git a/R/ds.cbind.R b/R/ds.cbind.R index f162d3a7b..9e7880cf1 100644 --- a/R/ds.cbind.R +++ b/R/ds.cbind.R @@ -5,7 +5,7 @@ #' is combined column by column to produce a matrix written to the #' which is written to the serverside. For more details see #' the native R function {cbind}. The handling of argument -#' is the same as for {ds.dataframe} +#' is the same as for {ds.dataFrame} #' @param x This is a vector of character strings representing the names of the elemental #' components to be combined For example, the call: #' ds.cbind(x=c('DF_input','matrix.m','var_age'),newobj='cbind_output') will diff --git a/R/ds.dataframe.R b/R/ds.dataFrame.R similarity index 96% rename from R/ds.dataframe.R rename to R/ds.dataFrame.R index ba852dadf..f84936882 100644 --- a/R/ds.dataframe.R +++ b/R/ds.dataFrame.R @@ -1,18 +1,18 @@ #' -#' @title ds.dataframe calling dataframeDS +#' @title ds.dataFrame calling dataframeDS #' @description Creates a data frame from its elemental components: pre-existing data frames; #' single variables; matrices #' @details A data frame is a list of variables all with the same number of rows with unique row -#' names, which is of class 'data.frame'. ds.dataframe will create a data frame by combining +#' names, which is of class 'data.frame'. ds.dataFrame will create a data frame by combining #' a series of elemental components which may be pre-existing data.frames, matrices or variables. #' A critical requirement is that the length of all component variables, and the #' number of rows of the component data.frames or matrices must all be the same. The output -#' data.frame will then have this same number of rows. ds.dataframe calls the serverside +#' data.frame will then have this same number of rows. ds.dataFrame calls the serverside #' function dataframeDS which is almost the same as the native R function data.frame() #' and so several of the arguments are precisely the same as for data.frame() #' @param x This is a vector of character strings representing the names of the elemental #' components to be combined. For example, the call: -#' ds.dataframe(x=c('DF_input','matrix.m','var_age'),newobj='DF_output') will +#' ds.dataFrame(x=c('DF_input','matrix.m','var_age'),newobj='DF_output') will #' combine a pre-existing data.frame called DF_input with a matrix and a variable #' called var_age. The output will be the combined data.frame DF_output. As many #' elemental components as needed may be combined in any order e.g. 3 data.frames, @@ -20,7 +20,7 @@ #' be specified in a two step procedure, the first being a call to #' the native R environment on the client server: #' x.components<-c('DF_input1','matrix.m','DF_input2', 'var_age'); -#' ds.dataframe(x=x.components,newobj='DF_output') +#' ds.dataFrame(x=x.components,newobj='DF_output') #' @param row.names NULL or a single integer or character string specifying a #' column to be used as row names, or a character or integer vector giving the #' row names for the data frame. @@ -32,7 +32,7 @@ #' If necessary they are adjusted (by make.names) so that they are. #' As a slight modification to the standard data.frame() function in native #' R, if any column names are duplicated, the second and subsequent -#' occurances are given the suffixes .1, .2 etc by ds.dataframe and so +#' occurances are given the suffixes .1, .2 etc by ds.dataFrame and so #' there are never any duplicates when check.names is invoked by the #' serverside function dataframeDS #' @param stringsAsFactors logical: should character vectors be converted @@ -61,7 +61,7 @@ #' indicating whether has been created in each data source and if so whether #' it is in a valid form. If its form is not valid in at least one study - e.g. because #' a disclosure trap was tripped and creation of the full output object was blocked - -#' ds.dataframe() also returns any studysideMessages that can explain the error in creating +#' ds.dataFrame() also returns any studysideMessages that can explain the error in creating #' the full output object. As well as appearing on the screen at run time,if you wish to #' see the relevant studysideMessages at a later date you can use the {ds.message} #' function. If you type ds.message("newobj") it will print out the relevant @@ -71,7 +71,7 @@ #' will return the message: "ALL OK: there are no studysideMessage(s) on this datasource". #' @author DataSHIELD Development Team #' @export -ds.dataframe<-function(x=NULL,row.names=NULL,check.rows=FALSE,check.names=TRUE,stringsAsFactors=TRUE,completeCases=FALSE,DataSHIELD.checks=FALSE,newobj='df_new',datasources=NULL,notify.of.progress=FALSE){ +ds.dataFrame<-function(x=NULL,row.names=NULL,check.rows=FALSE,check.names=TRUE,stringsAsFactors=TRUE,completeCases=FALSE,DataSHIELD.checks=FALSE,newobj='df_new',datasources=NULL,notify.of.progress=FALSE){ # if no opal login details are provided look for 'opal' objects in the environment if(is.null(datasources)){ @@ -285,5 +285,5 @@ if(!no.errors){ # ############################################################################################################# } -#ds.dataframe +#ds.dataFrame diff --git a/R/ds.dim.R b/R/ds.dim.R index da2a26a48..fadaacc42 100644 --- a/R/ds.dim.R +++ b/R/ds.dim.R @@ -17,7 +17,7 @@ #' these objects hold also the data assign to R, as \code{dataframe}, from opal datasources. #' @return for an array, \code{NULL} or a vector of mode \code{integer} #' @author Amadou Gaye, Julia Isaeva, Demetris Avraam, for DataSHIELD Development Team -#' @seealso \link{ds.dataframe} to generate a table of type dataframe. +#' @seealso \link{ds.dataFrame} to generate a table of type dataframe. #' @seealso \link{ds.changeRefGroup} to change the reference level of a factor. #' @seealso \link{ds.colnames} to obtain the column names of a matrix or a data frame #' @seealso \link{ds.asMatrix} to coerce an object into a matrix type. diff --git a/R/ds.rbind.R b/R/ds.rbind.R index 2e7bd2316..115291101 100644 --- a/R/ds.rbind.R +++ b/R/ds.rbind.R @@ -5,7 +5,7 @@ #' is combined row by row to produce a matrix #' which is written to the serverside. For more details see #' the native R function {rbind}. The handling of argument -#' is similar to that of functions {ds.cbind} and {ds.dataframe} +#' is similar to that of functions {ds.cbind} and {ds.dataFrame} #' @param x This is a vector of character strings representing the names of the elemental #' components to be combined. For example, the call: #' ds.rbind(x=c('matrix.m','matrix.n'),newobj='rbind_output') will diff --git a/R/ds.reShape.R b/R/ds.reShape.R index 4b7c7b987..f6900983b 100644 --- a/R/ds.reShape.R +++ b/R/ds.reShape.R @@ -61,7 +61,7 @@ #' indicating whether has been created in each data source and if so whether #' it is in a valid form. If its form is not valid in at least one study - e.g. because #' a disclosure trap was tripped and creation of the full output object was blocked - -#' ds.dataframe() also returns any studysideMessages that can explain the error in creating +#' ds.dataFrame() also returns any studysideMessages that can explain the error in creating #' the full output object. As well as appearing on the screen at run time,if you wish to #' see the relevant studysideMessages at a later date you can use the {ds.message} #' function. If you type ds.message('newobj') it will print out the relevant diff --git a/man/ds.cbind.Rd b/man/ds.cbind.Rd index 0f79aaed9..d58d45fbd 100644 --- a/man/ds.cbind.Rd +++ b/man/ds.cbind.Rd @@ -95,7 +95,7 @@ A sequence of vector, matrix or data-frame arguments is combined column by column to produce a matrix written to the which is written to the serverside. For more details see the native R function {cbind}. The handling of argument -is the same as for {ds.dataframe} +is the same as for {ds.dataFrame} } \author{ Paul Burton for DataSHIELD Development Team diff --git a/man/ds.dataframe.Rd b/man/ds.dataFrame.Rd similarity index 89% rename from man/ds.dataframe.Rd rename to man/ds.dataFrame.Rd index cacc912fc..ce547cc64 100644 --- a/man/ds.dataframe.Rd +++ b/man/ds.dataFrame.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ds.dataframe.R -\name{ds.dataframe} -\alias{ds.dataframe} -\title{ds.dataframe calling dataframeDS} +% Please edit documentation in R/ds.dataFrame.R +\name{ds.dataFrame} +\alias{ds.dataFrame} +\title{ds.dataFrame calling dataframeDS} \usage{ -ds.dataframe(x = NULL, row.names = NULL, check.rows = FALSE, +ds.dataFrame(x = NULL, row.names = NULL, check.rows = FALSE, check.names = TRUE, stringsAsFactors = TRUE, completeCases = FALSE, DataSHIELD.checks = FALSE, newobj = "df_new", datasources = NULL, notify.of.progress = FALSE) @@ -12,7 +12,7 @@ ds.dataframe(x = NULL, row.names = NULL, check.rows = FALSE, \arguments{ \item{x}{This is a vector of character strings representing the names of the elemental components to be combined. For example, the call: -ds.dataframe(x=c('DF_input','matrix.m','var_age'),newobj='DF_output') will +ds.dataFrame(x=c('DF_input','matrix.m','var_age'),newobj='DF_output') will combine a pre-existing data.frame called DF_input with a matrix and a variable called var_age. The output will be the combined data.frame DF_output. As many elemental components as needed may be combined in any order e.g. 3 data.frames, @@ -20,7 +20,7 @@ elemental components as needed may be combined in any order e.g. 3 data.frames, be specified in a two step procedure, the first being a call to the native R environment on the client server: x.components<-c('DF_input1','matrix.m','DF_input2', 'var_age'); -ds.dataframe(x=x.components,newobj='DF_output')} +ds.dataFrame(x=x.components,newobj='DF_output')} \item{row.names}{NULL or a single integer or character string specifying a column to be used as row names, or a character or integer vector giving the @@ -35,7 +35,7 @@ valid variable names and are not duplicated. If necessary they are adjusted (by make.names) so that they are. As a slight modification to the standard data.frame() function in native R, if any column names are duplicated, the second and subsequent -occurances are given the suffixes .1, .2 etc by ds.dataframe and so +occurances are given the suffixes .1, .2 etc by ds.dataFrame and so there are never any duplicates when check.names is invoked by the serverside function dataframeDS} @@ -72,7 +72,7 @@ which is written to the serverside. In addition, two validity messages are retur indicating whether has been created in each data source and if so whether it is in a valid form. If its form is not valid in at least one study - e.g. because a disclosure trap was tripped and creation of the full output object was blocked - -ds.dataframe() also returns any studysideMessages that can explain the error in creating +ds.dataFrame() also returns any studysideMessages that can explain the error in creating the full output object. As well as appearing on the screen at run time,if you wish to see the relevant studysideMessages at a later date you can use the {ds.message} function. If you type ds.message("newobj") it will print out the relevant @@ -87,11 +87,11 @@ single variables; matrices } \details{ A data frame is a list of variables all with the same number of rows with unique row -names, which is of class 'data.frame'. ds.dataframe will create a data frame by combining +names, which is of class 'data.frame'. ds.dataFrame will create a data frame by combining a series of elemental components which may be pre-existing data.frames, matrices or variables. A critical requirement is that the length of all component variables, and the number of rows of the component data.frames or matrices must all be the same. The output -data.frame will then have this same number of rows. ds.dataframe calls the serverside +data.frame will then have this same number of rows. ds.dataFrame calls the serverside function dataframeDS which is almost the same as the native R function data.frame() and so several of the arguments are precisely the same as for data.frame() } diff --git a/man/ds.dim.Rd b/man/ds.dim.Rd index 15639d908..55f322c71 100644 --- a/man/ds.dim.Rd +++ b/man/ds.dim.Rd @@ -63,7 +63,7 @@ of each study separately. } \seealso{ -\link{ds.dataframe} to generate a table of type dataframe. +\link{ds.dataFrame} to generate a table of type dataframe. \link{ds.changeRefGroup} to change the reference level of a factor. diff --git a/man/ds.rbind.Rd b/man/ds.rbind.Rd index 8714ef2d6..34e036bcf 100644 --- a/man/ds.rbind.Rd +++ b/man/ds.rbind.Rd @@ -93,7 +93,7 @@ A sequence of vector, matrix or data-frame arguments is combined row by row to produce a matrix which is written to the serverside. For more details see the native R function {rbind}. The handling of argument -is similar to that of functions {ds.cbind} and {ds.dataframe} +is similar to that of functions {ds.cbind} and {ds.dataFrame} } \author{ Paul Burton for DataSHIELD Development Team diff --git a/man/ds.reShape.Rd b/man/ds.reShape.Rd index dc11c5f9c..e816d4584 100644 --- a/man/ds.reShape.Rd +++ b/man/ds.reShape.Rd @@ -76,7 +76,7 @@ In addition, two validity messages are returned to the clientside indicating whether has been created in each data source and if so whether it is in a valid form. If its form is not valid in at least one study - e.g. because a disclosure trap was tripped and creation of the full output object was blocked - -ds.dataframe() also returns any studysideMessages that can explain the error in creating +ds.dataFrame() also returns any studysideMessages that can explain the error in creating the full output object. As well as appearing on the screen at run time,if you wish to see the relevant studysideMessages at a later date you can use the {ds.message} function. If you type ds.message('newobj') it will print out the relevant diff --git a/tests/testthat/test-arg-ds.dataframe.R b/tests/testthat/test-arg-ds.dataFrame.R similarity index 83% rename from tests/testthat/test-arg-ds.dataframe.R rename to tests/testthat/test-arg-ds.dataFrame.R index 6824b3156..af08814d8 100644 --- a/tests/testthat/test-arg-ds.dataframe.R +++ b/tests/testthat/test-arg-ds.dataFrame.R @@ -18,12 +18,12 @@ connect.studies.dataset.cnsim(list("LAB_TSC")) # Tests # -context("ds.dataframe::arg::test errors") +context("ds.dataFrame::arg::test errors") test_that("dataframe_erros", { - expect_error(ds.dataframe(), "Please provide the name of the list that holds the input vectors!", fixed=TRUE) + expect_error(ds.dataFrame(), "Please provide the name of the list that holds the input vectors!", fixed=TRUE) ds.asList(x='D$A', newobj="as_list") - expect_error(ds.dataframe("as_list", DataSHIELD.checks=TRUE), " Only objects of type 'data.frame', 'matrix', 'numeric', 'integer', 'character', 'factor' and 'logical' are allowed.", fixed=TRUE) + expect_error(ds.dataFrame("as_list", DataSHIELD.checks=TRUE), " Only objects of type 'data.frame', 'matrix', 'numeric', 'integer', 'character', 'factor' and 'logical' are allowed.", fixed=TRUE) }) # diff --git a/tests/testthat/test-disc-ds.mean.R b/tests/testthat/test-disc-ds.mean.R index 07483f723..670bc40df 100644 --- a/tests/testthat/test-disc-ds.mean.R +++ b/tests/testthat/test-disc-ds.mean.R @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG")) context("ds.mean::disc::type=both") test_that("mean values [both]", { myvectors <- c("D$LAB_TSC", "D$LAB_TRIG") - ds.dataframe(x=myvectors, newobj="unsubset_df") + ds.dataFrame(x=myvectors, newobj="unsubset_df") ds.dataFrameSubset(df.name="unsubset_df", V1.name="D$LAB_TSC", V2.name="D$LAB_TRIG", Boolean.operator=">", newobj="subset_df") diff --git a/tests/testthat/test-disc-ds.var.R b/tests/testthat/test-disc-ds.var.R index 8b915867c..bb975e3f9 100644 --- a/tests/testthat/test-disc-ds.var.R +++ b/tests/testthat/test-disc-ds.var.R @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG")) context("ds.var::disc::type=both") test_that("var values [both]", { myvectors <- c("D$LAB_TSC", "D$LAB_TRIG") - ds.dataframe(x=myvectors, newobj="unsubset_df") + ds.dataFrame(x=myvectors, newobj="unsubset_df") ds.dataFrameSubset(df.name="unsubset_df", V1.name="D$LAB_TSC", V2.name="D$LAB_TRIG", Boolean.operator=">", newobj="subset_df") diff --git a/tests/testthat/test-smk-checkClass.R b/tests/testthat/test-smk-checkClass.R index 27decff4c..9a3eb8f26 100644 --- a/tests/testthat/test-smk-checkClass.R +++ b/tests/testthat/test-smk-checkClass.R @@ -69,7 +69,7 @@ test_that("simple test", { test_that("data.frame test", { myvectors <- c('D$LAB_TSC', 'D$LAB_HDL') - ds.dataframe(x=myvectors) + ds.dataFrame(x=myvectors) res <- checkClass(ds.test_env$connection.opal, "df_new") diff --git a/tests/testthat/test-smk-ds.colnames.R b/tests/testthat/test-smk-ds.colnames.R index dc13a5f8e..fef1edb54 100644 --- a/tests/testthat/test-smk-ds.colnames.R +++ b/tests/testthat/test-smk-ds.colnames.R @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_TRIG")) context("ds.colnames::smk") test_that("simple colnames", { myvectors <- c("D$LAB_TSC", "D$LAB_TRIG") - ds.dataframe(x=myvectors, newobj="new_df") + ds.dataFrame(x=myvectors, newobj="new_df") res <- ds.colnames("new_df") diff --git a/tests/testthat/test-smk-ds.dataframe.R b/tests/testthat/test-smk-ds.dataFrame.R similarity index 85% rename from tests/testthat/test-smk-ds.dataframe.R rename to tests/testthat/test-smk-ds.dataFrame.R index 40860955e..e3ca30f99 100644 --- a/tests/testthat/test-smk-ds.dataframe.R +++ b/tests/testthat/test-smk-ds.dataFrame.R @@ -18,10 +18,10 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL")) # Tests # -context("ds.dataframe::smk::create a dataframe") +context("ds.dataFrame::smk::create a dataframe") test_that("dataframe_exists", { vectors <- c('D$LAB_TSC', 'D$LAB_HDL') - ds.dataframe(x=vectors) + ds.dataFrame(x=vectors) res <- ds.ls(datasources=ds.test_env$connection.opal) expect_equal(res$sim1[2], "df_new") @@ -29,10 +29,10 @@ test_that("dataframe_exists", { expect_equal(res$sim3[2], "df_new") }) -context("ds.dataframe::smk::create a dataframe, with DataSHIELD.checks") +context("ds.dataFrame::smk::create a dataframe, with DataSHIELD.checks") test_that("dataframe_exists, with DataSHIELD.checks", { vectors <- c('D$LAB_TSC', 'D$LAB_HDL') - ds.dataframe(x=vectors, DataSHIELD.checks=TRUE) + ds.dataFrame(x=vectors, DataSHIELD.checks=TRUE) res <- ds.ls(datasources=ds.test_env$connection.opal) expect_equal(res$sim1[2], "df_new") diff --git a/tests/testthat/test-smk-ds.dataFrameSort.R b/tests/testthat/test-smk-ds.dataFrameSort.R index 26291e3e2..94a32639d 100644 --- a/tests/testthat/test-smk-ds.dataFrameSort.R +++ b/tests/testthat/test-smk-ds.dataFrameSort.R @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL")) context("ds.dataFrameSort::smk::create a sorted dataframe") test_that("dataFrameSort_exists", { myvectors <- c('D$LAB_TSC', 'D$LAB_HDL') - ds.dataframe(x=myvectors, newobj="unsorted_df") + ds.dataFrame(x=myvectors, newobj="unsorted_df") res <- ds.dataFrameSort(df.name="unsorted_df", sort.key.name="D$LAB_TSC", newobj="sorted_df") diff --git a/tests/testthat/test-smk-ds.dataFrameSubset.R b/tests/testthat/test-smk-ds.dataFrameSubset.R index f0b5b77ff..32f3d23e5 100644 --- a/tests/testthat/test-smk-ds.dataFrameSubset.R +++ b/tests/testthat/test-smk-ds.dataFrameSubset.R @@ -21,7 +21,7 @@ connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL")) context("ds.dataFrameSubset::smk::create a subset dataframe") test_that("dataFrameSubset_exists", { myvectors <- c('D$LAB_TSC', 'D$LAB_HDL') - ds.dataframe(x=myvectors, newobj="unsubset_df") + ds.dataFrame(x=myvectors, newobj="unsubset_df") res <- ds.dataFrameSubset(df.name="unsubset_df", V1.name="D$LAB_TSC", V2.name="D$LAB_HDL", Boolean.operator="!=", newobj="subset_df") diff --git a/tests/testthat/test-smk-ds.isValid.R b/tests/testthat/test-smk-ds.isValid.R index 3fed3ebff..96e269654 100644 --- a/tests/testthat/test-smk-ds.isValid.R +++ b/tests/testthat/test-smk-ds.isValid.R @@ -31,7 +31,7 @@ test_that("isValid", { expect_true(res1$sim3) # myvectors <- c("D$LAB_TSC", "D$LAB_TRIG") -# ds.dataframe(x=myvectors, newobj="unsubset_df") +# ds.dataFrame(x=myvectors, newobj="unsubset_df") # ds.dataFrameSubset(df.name="unsubset_df", V1.name="D$LAB_TSC", V2.name="D$LAB_TRIG", Boolean.operator=">", newobj="subset_df") # res2 <- ds.isValid(x="subset_df") diff --git a/tests/testthat/test-smk-ds.merge.R b/tests/testthat/test-smk-ds.merge.R index bd80feeeb..03c2077b1 100644 --- a/tests/testthat/test-smk-ds.merge.R +++ b/tests/testthat/test-smk-ds.merge.R @@ -22,8 +22,8 @@ context("ds.merge::smk") test_that("simple test", { spec_vectors_1 <- c('D$LAB_TSC', 'D$LAB_HDL') spec_vectors_2 <- c('D$LAB_TSC', 'D$DIS_AMI') - ds.dataframe(x=spec_vectors_1, newobj="test_1_df") - ds.dataframe(x=spec_vectors_2, newobj="test_2_df") + ds.dataFrame(x=spec_vectors_1, newobj="test_1_df") + ds.dataFrame(x=spec_vectors_2, newobj="test_2_df") res <- ds.merge(x.name="test_1_df", y.name="test_2_df", by.x.names="D$LAB_TSC", by.y.names="D$LAB_TSC", newobj="merge_newobj")