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
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/ds.cbind.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <x>
#' 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
Expand Down
18 changes: 9 additions & 9 deletions R/ds.dataframe.R → R/ds.dataFrame.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#'
#' @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,
#' 7 variables and 2 matrices. For convenience the x argument can alternatively
#' 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.
Expand All @@ -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
Expand Down Expand Up @@ -61,7 +61,7 @@
#' indicating whether <newobj> 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
Expand All @@ -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)){
Expand Down Expand Up @@ -285,5 +285,5 @@ if(!no.errors){ #
#############################################################################################################

}
#ds.dataframe
#ds.dataFrame

2 changes: 1 addition & 1 deletion R/ds.dim.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/ds.rbind.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <x>
#' 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
Expand Down
2 changes: 1 addition & 1 deletion R/ds.reShape.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#' indicating whether <newobj> 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
Expand Down
2 changes: 1 addition & 1 deletion man/ds.cbind.Rd

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

22 changes: 11 additions & 11 deletions man/ds.dataframe.Rd → man/ds.dataFrame.Rd

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

2 changes: 1 addition & 1 deletion man/ds.dim.Rd

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

2 changes: 1 addition & 1 deletion man/ds.rbind.Rd

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

2 changes: 1 addition & 1 deletion man/ds.reShape.Rd

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

Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

#
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-disc-ds.mean.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-disc-ds.var.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-smk-checkClass.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-smk-ds.colnames.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ 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")
expect_equal(res$sim2[2], "df_new")
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")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-smk-ds.dataFrameSort.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-smk-ds.dataFrameSubset.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-smk-ds.isValid.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-smk-ds.merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down