From 9dc690bc1c513d300243e8330d6025d03427eddf Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Wed, 10 Jul 2024 12:12:23 +0100 Subject: [PATCH 01/24] Update to documentation --- DESCRIPTION | 4 +- docs/404.html | 12 +- docs/LICENSE.html | 12 +- docs/authors.html | 22 +- docs/index.html | 12 +- docs/pkgdown.yml | 5 +- docs/reference/BooleDS.html | 26 +- docs/reference/absDS.html | 24 +- docs/reference/asCharacterDS.html | 24 +- docs/reference/asDataMatrixDS.html | 24 +- docs/reference/asFactorDS1.html | 22 +- docs/reference/asFactorDS2.html | 28 +- docs/reference/asFactorSimpleDS.html | 26 +- docs/reference/asIntegerDS.html | 22 +- docs/reference/asListDS.html | 30 +- docs/reference/asLogicalDS.html | 24 +- docs/reference/asMatrixDS.html | 24 +- docs/reference/asNumericDS.html | 22 +- docs/reference/aucDS.html | 30 +- docs/reference/blackBoxDS.html | 32 +- docs/reference/blackBoxRanksDS.html | 28 +- docs/reference/boxPlotGGDS.html | 45 +- .../reference/boxPlotGG_data_TreatmentDS.html | 47 +- .../boxPlotGG_data_Treatment_numericDS.html | 33 +- docs/reference/bp_standardsDS.html | 44 +- docs/reference/cDS.html | 24 +- docs/reference/cbindDS.html | 26 +- docs/reference/changeRefGroupDS.html | 30 +- docs/reference/checkNegValueDS.html | 24 +- .../checkPermissivePrivacyControlLevel.html | 20 +- docs/reference/classDS.html | 22 +- docs/reference/colnamesDS.html | 22 +- docs/reference/completeCasesDS.html | 30 +- docs/reference/corDS.html | 24 +- docs/reference/corTestDS.html | 30 +- docs/reference/covDS.html | 26 +- docs/reference/dataFrameDS.html | 34 +- docs/reference/dataFrameFillDS.html | 34 +- docs/reference/dataFrameSortDS.html | 28 +- docs/reference/dataFrameSubsetDS1.html | 34 +- docs/reference/dataFrameSubsetDS2.html | 40 +- docs/reference/densityGridDS.html | 36 +- docs/reference/dimDS.html | 22 +- docs/reference/dmtC2SDS.html | 36 +- docs/reference/elsplineDS.html | 28 +- docs/reference/extract.html | 22 +- docs/reference/extractQuantilesDS1.html | 24 +- docs/reference/extractQuantilesDS2.html | 24 +- docs/reference/gamlssDS.html | 130 ++-- docs/reference/getWGSRDS.html | 38 +- docs/reference/glmDS1.html | 26 +- docs/reference/glmDS2.html | 28 +- docs/reference/glmPredictDS.ag.html | 34 +- docs/reference/glmPredictDS.as.html | 38 +- docs/reference/glmSLMADS.assign.html | 30 +- docs/reference/glmSLMADS1.html | 30 +- docs/reference/glmSLMADS2.html | 32 +- docs/reference/glmSummaryDS.ag.html | 28 +- docs/reference/glmSummaryDS.as.html | 34 +- docs/reference/glmerSLMADS.assign.html | 44 +- docs/reference/glmerSLMADS2.html | 46 +- docs/reference/heatmapPlotDS.html | 34 +- docs/reference/hetcorDS.html | 32 +- docs/reference/histogramDS1.html | 38 +- docs/reference/histogramDS2.html | 40 +- docs/reference/igb_standardsDS.html | 40 +- docs/reference/index.html | 14 +- docs/reference/isNaDS.html | 26 +- docs/reference/isValidDS.html | 22 +- docs/reference/kurtosisDS1.html | 26 +- docs/reference/kurtosisDS2.html | 32 +- docs/reference/lengthDS.html | 22 +- docs/reference/levelsDS.html | 22 +- docs/reference/lexisDS1.html | 18 +- docs/reference/lexisDS2.html | 34 +- docs/reference/lexisDS3.html | 14 +- docs/reference/listDS.html | 24 +- docs/reference/listDisclosureSettingsDS.html | 14 +- docs/reference/lmerSLMADS.assign.html | 38 +- docs/reference/lmerSLMADS2.html | 38 +- docs/reference/lsDS.html | 30 +- docs/reference/lsplineDS.html | 28 +- docs/reference/matrixDS.html | 32 +- docs/reference/matrixDetDS1.html | 24 +- docs/reference/matrixDetDS2.html | 24 +- docs/reference/matrixDiagDS.html | 26 +- docs/reference/matrixDimnamesDS.html | 24 +- docs/reference/matrixInvertDS.html | 22 +- docs/reference/matrixMultDS.html | 24 +- docs/reference/matrixTransposeDS.html | 22 +- docs/reference/meanDS.html | 22 +- docs/reference/meanSdGpDS.html | 20 +- docs/reference/mergeDS.html | 46 +- docs/reference/messageDS.html | 22 +- docs/reference/metadataDS.html | 22 +- docs/reference/miceDS.html | 80 +-- docs/reference/minMaxRandDS.html | 22 +- docs/reference/namesDS.html | 22 +- docs/reference/nsDS.html | 32 +- docs/reference/numNaDS.html | 26 +- docs/reference/qlsplineDS.html | 32 +- docs/reference/quantileMeanDS.html | 22 +- docs/reference/rBinomDS.html | 26 +- docs/reference/rNormDS.html | 28 +- docs/reference/rPoisDS.html | 24 +- docs/reference/rUnifDS.html | 28 +- docs/reference/rangeDS.html | 26 +- docs/reference/ranksSecureDS1.html | 18 +- docs/reference/ranksSecureDS2.html | 20 +- docs/reference/ranksSecureDS3.html | 24 +- docs/reference/ranksSecureDS4.html | 22 +- docs/reference/ranksSecureDS5.html | 22 +- docs/reference/rbindDS.html | 30 +- docs/reference/reShapeDS.html | 36 +- docs/reference/recodeLevelsDS.html | 28 +- docs/reference/recodeValuesDS.html | 30 +- docs/reference/repDS.html | 48 +- docs/reference/replaceNaDS.html | 34 +- docs/reference/rmDS.html | 22 +- docs/reference/rowColCalcDS.html | 26 +- docs/reference/sampleDS.html | 38 +- docs/reference/scatterPlotDS.html | 30 +- docs/reference/seqDS.html | 46 +- docs/reference/setFilterDS.html | 22 +- docs/reference/setSeedDS.html | 26 +- docs/reference/skewnessDS1.html | 26 +- docs/reference/skewnessDS2.html | 32 +- docs/reference/sqrtDS.html | 24 +- docs/reference/subsetByClassDS.html | 32 +- docs/reference/subsetByClassHelper1.html | 26 +- docs/reference/subsetByClassHelper2.html | 30 +- docs/reference/subsetByClassHelper3.html | 30 +- docs/reference/subsetDS.html | 54 +- docs/reference/table1DDS.html | 28 +- docs/reference/table2DDS.html | 24 +- docs/reference/tableDS.assign.html | 38 +- docs/reference/tableDS.html | 42 +- docs/reference/tableDS2.html | 30 +- docs/reference/tapplyDS.assign.html | 26 +- docs/reference/tapplyDS.html | 26 +- docs/reference/testObjExistsDS.html | 18 +- docs/reference/unListDS.html | 40 +- docs/reference/uniqueDS.html | 22 +- docs/reference/varDS.html | 22 +- docs/reference/vectorDS.html | 22 +- docs/sitemap.xml | 580 +++++------------- 146 files changed, 2218 insertions(+), 2560 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7837f04d..2c8ded58 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: dsBase Title: DataSHIELD server site base functions Description: DataSHIELD server site base functions. -Version: 6.3.1.9000 +Version: 6.4.0.9000 Author: DataSHIELD Developers Maintainer: DataSHIELD Developers License: GPL-3 @@ -196,5 +196,5 @@ Options: default.nfilter.noise=0.25, default.nfilter.levels.density=0.33, default.nfilter.levels.max=40 -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Encoding: UTF-8 diff --git a/docs/404.html b/docs/404.html index 119c78ce..685b0835 100644 --- a/docs/404.html +++ b/docs/404.html @@ -18,7 +18,7 @@ - +
@@ -50,7 +50,7 @@
- +
@@ -78,16 +78,16 @@

Page not found (404)

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/LICENSE.html b/docs/LICENSE.html index e8aacff1..c6d7f7d8 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -3,7 +3,7 @@ - +
@@ -29,7 +29,7 @@
- +
@@ -242,15 +242,15 @@

NA

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/authors.html b/docs/authors.html index f0c166fa..c7ed6237 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -3,7 +3,7 @@ - +
@@ -29,7 +29,7 @@
- +
@@ -38,29 +38,29 @@

Authors and Citation

- +
  • -

    DataSHIELD Developers. Maintainer. +

    DataSHIELD Developers. Maintainer.

Citation

- +

Developers D (2024). dsBase: DataSHIELD server site base functions. -R package version 6.3.1.9000. +R package version 6.4.0.9000.

@Manual{,
   title = {dsBase: DataSHIELD server site base functions},
   author = {DataSHIELD Developers},
   year = {2024},
-  note = {R package version 6.3.1.9000},
+  note = {R package version 6.4.0.9000},
 }
@@ -74,15 +74,15 @@

Citation

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/index.html b/docs/index.html index ad662742..8f56319d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -19,7 +19,7 @@ - +
@@ -51,7 +51,7 @@
- +
@@ -162,16 +162,16 @@

Developers

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 7022ee43..45bb2716 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,6 +1,5 @@ pandoc: 2.9.2.1 -pkgdown: 2.0.9 +pkgdown: 2.1.0 pkgdown_sha: ~ articles: {} -last_built: 2024-06-06T11:36Z - +last_built: 2024-07-10T11:10Z diff --git a/docs/reference/BooleDS.html b/docs/reference/BooleDS.html index 3ad03d3b..6a25a2c3 100644 --- a/docs/reference/BooleDS.html +++ b/docs/reference/BooleDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -57,17 +57,19 @@

BooleDS

Arguments

-
V1.name
+ + +
V1.name

A character string specifying the name of the vector to which the Boolean operator is to be applied

-
V2.name
+
V2.name

A character string specifying the name of the vector or scalar to which <V1> is to be compared.

-
Boolean.operator.n
+
Boolean.operator.n

An integer value (1 to 6) providing a numeric coding for the character string specifying one of six possible Boolean operators: '==', '!=', '>', '>=','<', '<=' @@ -75,7 +77,7 @@

Arguments

from client to server via DataSHIELD parser

-
na.assign.text
+
na.assign.text

A character string taking values 'NA', '1' or '0'. If 'NA' then any NA values in the input vector remain as NAs in the output vector. If '1' or '0' NA values in the @@ -83,7 +85,7 @@

Arguments

all converted to 1 or 0 respectively.#' @return the levels of the input variable.

-
numeric.output
+
numeric.output

a TRUE/FALSE indicator defaulting to TRUE determining whether the final output variable should be of class numeric (1/0) or class logical (TRUE/FALSE).

@@ -110,15 +112,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/absDS.html b/docs/reference/absDS.html index cf683fe3..c08c5663 100644 --- a/docs/reference/absDS.html +++ b/docs/reference/absDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,17 +49,17 @@

Computes the absolute values of the input variable

Arguments

-
x
+ + +
x

a string character, the name of a numeric or integer vector

Value

- - -

the object specified by the newobj argument +

the object specified by the newobj argument of ds.abs (or default name abs.newobj) -which is written to the serverside. The output object is of class numeric +which is written to the serverside. The output object is of class numeric or integer.

@@ -84,15 +84,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asCharacterDS.html b/docs/reference/asCharacterDS.html index b9f7e46f..9823966a 100644 --- a/docs/reference/asCharacterDS.html +++ b/docs/reference/asCharacterDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,7 +49,9 @@

Coerces an R object into class character

Arguments

-
x.name
+ + +
x.name

the name of the input object to be coerced to class character. Must be specified in inverted commas. But this argument is usually specified directly by x.name argument of the clientside function @@ -58,13 +60,9 @@

Arguments

Value

- - -

the object specified by the newobj argument (or its default name +

the object specified by the newobj argument (or its default name "ascharacter.newobj") which is written to the serverside. For further details see help on the clientside function ds.asCharacter

- -

Details

@@ -87,15 +85,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asDataMatrixDS.html b/docs/reference/asDataMatrixDS.html index cfa6a7f3..09a6a41b 100644 --- a/docs/reference/asDataMatrixDS.html +++ b/docs/reference/asDataMatrixDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,7 +51,9 @@

asDataMatrixDS a serverside assign function called by ds.asDataMatrix

Arguments

-
x.name
+ + +
x.name

the name of the input object to be coerced to class data.matrix. Must be specified in inverted commas. But this argument is usually specified directly by <x.name> argument of the clientside function @@ -60,13 +62,9 @@

Arguments

Value

- - -

the object specified by the <newobj> argument (or its default name +

the object specified by the <newobj> argument (or its default name "asdatamatrix.newobj") which is written to the serverside. For further details see help on the clientside function ds.asDataMatrix

- -

Details

@@ -94,15 +92,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asFactorDS1.html b/docs/reference/asFactorDS1.html index bb3513b7..811f9902 100644 --- a/docs/reference/asFactorDS1.html +++ b/docs/reference/asFactorDS1.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,15 +51,15 @@

Determines the levels of the input variable in each single study

Arguments

-
input.var.name
+ + +
input.var.name

the name of the variable that is to be converted to a factor.

Value

- - -

the levels of the input variable.

+

the levels of the input variable.

Details

@@ -80,15 +80,15 @@

Details

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asFactorDS2.html b/docs/reference/asFactorDS2.html index cd50f47c..80f9c18a 100644 --- a/docs/reference/asFactorDS2.html +++ b/docs/reference/asFactorDS2.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -56,15 +56,17 @@

Converts a numeric vector into a factor

Arguments

-
input.var.name
+ + +
input.var.name

the name of the variable that is to be converted to a factor.

-
all.unique.levels.transmit
+
all.unique.levels.transmit

the levels that the variable will be transmitted to.

-
fixed.dummy.vars
+
fixed.dummy.vars

a boolean that determines whether the new object will be represented as a vector or as a matrix of dummy variables indicating the factor level of each data point. If this argyment is set to FALSE (default) then the input variable is converted to a factor and @@ -72,16 +74,14 @@

Arguments

assigned as a matrix of dummy variables.

-
baseline.level
+
baseline.level

a number indicating the baseline level to be used in the creation of the matrix of dummy variables.

Value

- - -

an object of class factor

+

an object of class factor

Details

@@ -102,15 +102,15 @@

Details

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asFactorSimpleDS.html b/docs/reference/asFactorSimpleDS.html index 5a37fef3..e4edc098 100644 --- a/docs/reference/asFactorSimpleDS.html +++ b/docs/reference/asFactorSimpleDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,21 +51,21 @@

Converts a numeric vector into a factor

Arguments

-
input.var.name
+ + +
input.var.name

the name of the variable that is to be converted to a factor.

Value

- - -

an object of class factor

+

an object of class factor

Details

-

The functions converts the input variable into a factor. Unlike +

The functions converts the input variable into a factor. Unlike ds.asFactor and its serverside functions, ds.asFactorSimple does no more than -coerce the class of a variable to factor in each study. It does not check for +coerce the class of a variable to factor in each study. It does not check for or enforce consistency of factor levels across sources or allow you to force an arbitrary set of levels unless those levels actually exist in the sources. In addition, it does not allow you to create an array of @@ -85,15 +85,15 @@

Details

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asIntegerDS.html b/docs/reference/asIntegerDS.html index 94378ab3..4ad4dd94 100644 --- a/docs/reference/asIntegerDS.html +++ b/docs/reference/asIntegerDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,7 +49,9 @@

Coerces an R object into class integer

Arguments

-
x.name
+ + +
x.name

the name of the input object to be coerced to class integer. Must be specified in inverted commas. But this argument is usually specified directly by <x.name> argument of the clientside function @@ -58,9 +60,7 @@

Arguments

Value

- - -

the object specified by the <newobj> argument (or its default name +

the object specified by the <newobj> argument (or its default name "asinteger.newobj") which is written to the serverside. For further details see help on the clientside function ds.asInteger.

@@ -86,15 +86,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asListDS.html b/docs/reference/asListDS.html index cf405e4e..041e9017 100644 --- a/docs/reference/asListDS.html +++ b/docs/reference/asListDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,29 +49,27 @@

asListDS a serverside aggregate function called by ds.asList

Arguments

-
x.name
+ + +
x.name

the name of the input object to be coerced to class data.matrix. Must be specified in inverted commas. But this argument is usually specified directly by <x.name> argument of the clientside function ds.asList

-
newobj
+
newobj

is the object hard assigned '<<-' to be the output of the function written to the serverside

Value

- - -

the object specified by the <newobj> argument (or its default name +

the object specified by the <newobj> argument (or its default name <x.name>.mat) which is written to the serverside. In addition, two validity messages are returned. The first confirms an output -object has been created, the second states its class. The way that as.list

- - -

coerces objects to list depends on the class of the object, but in general +object has been created, the second states its class. The way that as.list +coerces objects to list depends on the class of the object, but in general the class of the output object should usually be 'list'

@@ -101,15 +99,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asLogicalDS.html b/docs/reference/asLogicalDS.html index d208ae32..9a4ba889 100644 --- a/docs/reference/asLogicalDS.html +++ b/docs/reference/asLogicalDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,7 +49,9 @@

Coerces an R object into class numeric

Arguments

-
x.name
+ + +
x.name

the name of the input object to be coerced to class numeric. Must be specified in inverted commas. But this argument is usually specified directly by <x.name> argument of the clientside function @@ -58,13 +60,9 @@

Arguments

Value

- - -

the object specified by the <newobj> argument (or its default name +

the object specified by the <newobj> argument (or its default name <x.name>.logic) which is written to the serverside. For further details see help on the clientside function ds.asLogical

- -

Details

@@ -87,15 +85,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asMatrixDS.html b/docs/reference/asMatrixDS.html index 40914725..36f1c522 100644 --- a/docs/reference/asMatrixDS.html +++ b/docs/reference/asMatrixDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,7 +49,9 @@

Coerces an R object into a matrix

Arguments

-
x.name
+ + +
x.name

the name of the input object to be coerced to class matrix. Must be specified in inverted commas. But this argument is usually specified directly by <x.name> argument of the clientside function @@ -58,13 +60,9 @@

Arguments

Value

- - -

the object specified by the <newobj> argument (or its default name +

the object specified by the <newobj> argument (or its default name <x.name>.mat) which is written to the serverside. For further details see help on the clientside function ds.asMatrix

- -

Details

@@ -87,15 +85,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/asNumericDS.html b/docs/reference/asNumericDS.html index aa2a97cb..07d3ed50 100644 --- a/docs/reference/asNumericDS.html +++ b/docs/reference/asNumericDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,7 +49,9 @@

Coerces an R object into class numeric

Arguments

-
x.name
+ + +
x.name

the name of the input object to be coerced to class numeric. Must be specified in inverted commas. But this argument is usually specified directly by <x.name> argument of the clientside function @@ -58,9 +60,7 @@

Arguments

Value

- - -

the object specified by the <newobj> argument (or its default name +

the object specified by the <newobj> argument (or its default name <x.name>.num) which is written to the serverside. For further details see help on the clientside function ds.asNumeric.

@@ -86,15 +86,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/aucDS.html b/docs/reference/aucDS.html index 0af240b6..3ecb682d 100644 --- a/docs/reference/aucDS.html +++ b/docs/reference/aucDS.html @@ -1,10 +1,10 @@ -aucDS an aggregate function called by ds.auc — aucDS • dsBaseaucDS an aggregate function called by ds.auc — aucDS • dsBase - +
@@ -30,18 +30,18 @@
- +
-

This function calculates the C-statistic or AUC for logistic +

This function calculates the C-statistic or AUC for logistic regression models.

@@ -51,20 +51,20 @@

aucDS an aggregate function called by ds.auc

Arguments

-
pred
+ + +
pred

the name of the vector of the predicted values

-
y
-

the name of the outcome variable. Note that this variable should include +

y
+

the name of the outcome variable. Note that this variable should include the complete cases that are used in the regression model.

Value

- - -

returns the AUC and its standard error

+

returns the AUC and its standard error

Details

@@ -87,15 +87,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/blackBoxDS.html b/docs/reference/blackBoxDS.html index 63b2bf62..b8ce5259 100644 --- a/docs/reference/blackBoxDS.html +++ b/docs/reference/blackBoxDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,13 +51,15 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources

Arguments

-
input.var.name
+ + +
input.var.name

a character string specifying the name of V2BR. This argument is set by the argument with the same name in the clientside function ds.ranksSecure

-
shared.seedval
+
shared.seedval

a pseudorandom number seed that ensures that the processes generating the order and parameterisation of the encryption algorithms are the same in each study. This argument is set by the argument @@ -67,16 +69,16 @@

Arguments

and the header file for ds.ranksSecure.

-
synth.real.ratio
+
synth.real.ratio

an integer value representing -the ratio of synthetic (pseudo-data) values to the real number of +the ratio of synthetic (pseudo-data) values to the real number of values in V2BR. This argument is set by the argument with the same name in the clientside function ds.ranksSecure. For more details, please see the associated document entitled "secure.global.ranking.docx" and the header file for ds.ranksSecure.

-
NA.manage
+
NA.manage

character string indicating how missing values (NAs) in V2BR should be managed. It takes three possible values: "NA.delete", "NA.low","NA.hi". This argument is set by the argument with the same name @@ -87,9 +89,7 @@

Arguments

Value

- - -

writes a data frame object entitled blackbox.output.df to the +

writes a data frame object entitled blackbox.output.df to the serverside. In each study this contains the encrypted "combined real+pseudo data vector" and a range of other key components from the first stage of the ranking procedure. For more details see the @@ -97,7 +97,7 @@

Value

Details

-

Severside assign function called by ds.ranksSecure. +

Severside assign function called by ds.ranksSecure. Creates pseudo-data by using the real distribution of values in V2BR to create a large number of synthetic data with a similar distribution to the values in V2BR but with a slightly broader distribution at both ends @@ -134,15 +134,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/blackBoxRanksDS.html b/docs/reference/blackBoxRanksDS.html index d1e51a8b..c7fbe9a1 100644 --- a/docs/reference/blackBoxRanksDS.html +++ b/docs/reference/blackBoxRanksDS.html @@ -6,7 +6,7 @@ - +
@@ -32,13 +32,13 @@
- +
@@ -55,13 +55,15 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources

Arguments

-
input.var.name
+ + +
input.var.name

a character string specifying the name of the vector holding the global ranks. This argument is set automatically by the clientside function ds.ranksSecure

-
shared.seedval
+
shared.seedval

a pseudorandom number seed that ensures that the processes generating the order and parameterisation of the encryption algorithms are the same in each study. This argument is set by the argument @@ -77,9 +79,7 @@

Arguments

Value

- - -

writes a data frame object entitled blackbox.ranks.df to the +

writes a data frame object entitled blackbox.ranks.df to the serverside. In each study this contains the encrypted global ranks and a range of other key components from the second stage (ranking of global ranks for real observations only) of the ranking procedure. For more details @@ -89,7 +89,7 @@

Value

Details

Severside assign function called by ds.ranksSecure. It takes the global ranks currently held in sR5.df which reflect the global ranks based on -the "combined real+pseudo data vector" as encrypted by blackBoxDS +the "combined real+pseudo data vector" as encrypted by blackBoxDS but with all pseudo-data stripped out. It then uses these global ranks (of the real data) as if they were a new variable to be ranked. This is then equivalent to blackBoxDS with the primary difference that no @@ -98,7 +98,7 @@

Details

disclosure. However, in order to ensure that the client cannot compare the list of global.ranks in sR4.df (after initial global ranking based on ranking of real and pseudo-data combined) with the global.ranks to be -generated by blackBoxRanksDS (based solely on the real data they are +generated by blackBoxRanksDS (based solely on the real data they are processed through seven more rounds of encryption as before in blackBoxDS. In consequence the client remains unable to determine which of the original global ranks corresponded to real data and which to pseudo-data. In @@ -126,15 +126,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/boxPlotGGDS.html b/docs/reference/boxPlotGGDS.html index 2a414e82..c1ed944a 100644 --- a/docs/reference/boxPlotGGDS.html +++ b/docs/reference/boxPlotGGDS.html @@ -1,12 +1,12 @@ Create the identity stats and necessary data to draw a plot on the client — boxPlotGGDS • dsBase - +
@@ -32,20 +32,20 @@
- +

In order to create a non disclosive box plot, the data that is passed to the client is purely geometrical aspects of the plot, as a ggplot object contains all the data inside, only the graphical -parameters are passed. There are three different cases depending if there are grouping variables. +parameters are passed. There are three different cases depending if there are grouping variables. The outliers are also removed from the graphical parameters.

@@ -55,7 +55,9 @@

Create the identity stats and necessary data to draw a plot on the client

Arguments

-
data_table
+ + +
data_table

data frame Table that holds the information to be plotted, arranged as:

Column 'x': Names on the X axis of the boxplot, aka variables to plot
Column 'value': Values for that variable (raw data of columns rbinded)
@@ -63,31 +65,20 @@

Arguments

Column 'group2': (Optional) Values of the second grouping variable

-
group
+
group

character (default NULL) Name of the first grouping variable.

-
group2
+
group2

character (default NULL) Name of the second grouping variable.

Value

- - -


- - - -

list with:

- - -

-data frame Geometrical parameters (identity stats of ggplot)

- - -

-character Type of plot (single_group, double_group or no_group)

- - +


+

list with:
+-data frame Geometrical parameters (identity stats of ggplot)
+-character Type of plot (single_group, double_group or no_group)

@@ -102,15 +93,15 @@

Value

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/boxPlotGG_data_TreatmentDS.html b/docs/reference/boxPlotGG_data_TreatmentDS.html index 510d8286..e6c1b15f 100644 --- a/docs/reference/boxPlotGG_data_TreatmentDS.html +++ b/docs/reference/boxPlotGG_data_TreatmentDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,42 +49,31 @@

Arrange data frame to pass it to the boxplot function

Arguments

-
table
+ + +
table

data frame Table that holds the information to be plotted later

-
variables
+
variables

character vector Name of the column(s) of the data frame to include on the boxplot

-
group
+
group

character (default NULL) Name of the first grouping variable.

-
group2
+
group2

character (default NULL) Name of the second grouping variable.

Value

- - -

data frame with the following structure:

- - - -

Column 'x': Names on the X axis of the boxplot, aka variables to plot

- - -

Column 'value': Values for that variable (raw data of columns rbinded)

- - -

Column 'group': (Optional) Values of the grouping variable

- - -

Column 'group2': (Optional) Values of the second grouping variable

- - +

data frame with the following structure:

+

Column 'x': Names on the X axis of the boxplot, aka variables to plot
+ Column 'value': Values for that variable (raw data of columns rbinded)
+ Column 'group': (Optional) Values of the grouping variable
+ Column 'group2': (Optional) Values of the second grouping variable

@@ -99,15 +88,15 @@

Value

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/boxPlotGG_data_Treatment_numericDS.html b/docs/reference/boxPlotGG_data_Treatment_numericDS.html index 6c0f9f88..d0313528 100644 --- a/docs/reference/boxPlotGG_data_Treatment_numericDS.html +++ b/docs/reference/boxPlotGG_data_Treatment_numericDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,24 +49,17 @@

Arrange vector to pass it to the boxplot function

Arguments

-
vector
+ + +
vector

numeric vector Vector to arrange to be plotted later

Value

- - -

data frame with the following structure:

- - - -

Column 'x': Names on the X axis of the boxplot, aka name of the vector (vector argument)

- - -

Column 'value': Values for that variable

- - +

data frame with the following structure:

+

Column 'x': Names on the X axis of the boxplot, aka name of the vector (vector argument)
+ Column 'value': Values for that variable

@@ -81,15 +74,15 @@

Value

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/bp_standardsDS.html b/docs/reference/bp_standardsDS.html index f1aee007..77d43af0 100644 --- a/docs/reference/bp_standardsDS.html +++ b/docs/reference/bp_standardsDS.html @@ -1,12 +1,12 @@ Calculates Blood pressure z-scores — bp_standardsDS • dsBase - +
@@ -32,19 +32,19 @@
- +

The function calculates blood pressure z-scores in two steps: -Step 1. Calculates z-score of height according to CDC growth chart (Not the +Step 1. Calculates z-score of height according to CDC growth chart (Not the WHO growth chart!). Step 2. Calculates z-score of BP according to the fourth report on BP management, USA

@@ -61,42 +61,42 @@

Calculates Blood pressure z-scores

Arguments

-
sex
+ + +
sex

the name of the sex variable. The variable should be coded as 1 for males -and 2 for females. If it is coded differently (e.g. 0/1), then you can use the -ds.recodeValues function to recode the categories to 1/2 before the use of +and 2 for females. If it is coded differently (e.g. 0/1), then you can use the +ds.recodeValues function to recode the categories to 1/2 before the use of ds.bp_standards

-
age
+
age

the name of the age variable in years.

-
height
+
height

the name of the height variable in cm

-
bp
+
bp

the name of the blood pressure variable.

-
systolic
-

logical. If TRUE (default) the function assumes conversion of -systolic blood pressure. If FALSE the function assumes conversion of diastolic +

systolic
+

logical. If TRUE (default) the function assumes conversion of +systolic blood pressure. If FALSE the function assumes conversion of diastolic blood pressure.

Value

- - -

assigns a new object on the server-side. The assigned object is a list +

assigns a new object on the server-side. The assigned object is a list with two elements: the 'Zbp' which is the zscores of the blood pressure and 'perc' which is the percentiles of the BP zscores.

Note

-

The z-scores of height based on CDC growth charts are calculated +

The z-scores of height based on CDC growth charts are calculated by the sds function from the childsds R package.

@@ -116,15 +116,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/cDS.html b/docs/reference/cDS.html index 5ec6e6b9..a82d843c 100644 --- a/docs/reference/cDS.html +++ b/docs/reference/cDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,19 +49,19 @@

Concatenates objects into a vector or list

Arguments

-
objs
+ + +
objs

a list which contains the the objects to concatenate.

Value

- - -

a vector or list

+

a vector or list

Details

-

Unlike the R base function 'c' on vector or list of certain +

Unlike the R base function 'c' on vector or list of certain length are allowed as output

@@ -81,15 +81,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/cbindDS.html b/docs/reference/cbindDS.html index 7496ea63..61194764 100644 --- a/docs/reference/cbindDS.html +++ b/docs/reference/cbindDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,23 +53,23 @@

cbindDS called by ds.cbind

Arguments

-
x.names.transmit
+ + +
x.names.transmit

This is a vector of character strings representing the names of the elemental components to be combined converted into a transmittable format. This argument is fully specified by the x argument of the client-side ds.cbind function.

-
colnames.transmit
+
colnames.transmit

This is a vector of character strings representing column names for the output object converted into a transmittable format.

Value

- - -

the object specified by the newobj argument +

the object specified by the newobj argument of ds.cbind (or default name cbind.newobj) which is written to the serverside. The output object is of class data.frame.

@@ -80,7 +80,7 @@

Details

which is written to the serverside. 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. For more details +data.frame will then have this same number of rows. For more details see help for ds.cbind and the native R function cbind.

@@ -100,15 +100,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/changeRefGroupDS.html b/docs/reference/changeRefGroupDS.html index 836a3756..7a1cad97 100644 --- a/docs/reference/changeRefGroupDS.html +++ b/docs/reference/changeRefGroupDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,30 +49,30 @@

Changes a reference level of a factor

Arguments

-
xvect
+ + +
xvect

a factor vector

-
ref
+
ref

a character, the reference level

-
reorderByRef
-

a boolean that tells whether or not the new +

reorderByRef
+

a boolean that tells whether or not the new vector should be ordered by the reference group.

Value

- - -

a factor of the same length as xvect

+

a factor of the same length as xvect

Details

In addition to what the R function does, this function allows for the user to re-order the vector, putting the reference -group first. If the user chooses the re-order a warning is issued +group first. If the user chooses the re-order a warning is issued as this can introduce a mismatch of values if the vector is put back into a table that is not reordered in the same way. Such mismatch can render the results of operations on that table invalid.

@@ -94,15 +94,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/checkNegValueDS.html b/docs/reference/checkNegValueDS.html index 102083d8..4942bc9e 100644 --- a/docs/reference/checkNegValueDS.html +++ b/docs/reference/checkNegValueDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,19 +49,19 @@

Checks if a numeric variable has negative values

Arguments

-
weights
+ + +
weights

a numeric vector

Value

- - -

a boolean; TRUE if the vector has one or more negative values and FALSE otherwise

+

a boolean; TRUE if the vector has one or more negative values and FALSE otherwise

Details

-

if a user sets the parameter 'weights' on the client site function ds.glm this +

if a user sets the parameter 'weights' on the client site function ds.glm this server side function is called to verify that the 'weights' vector does not have negative values because no negative are allowed in weights.

@@ -82,15 +82,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/checkPermissivePrivacyControlLevel.html b/docs/reference/checkPermissivePrivacyControlLevel.html index 9d4add36..2d7db9f8 100644 --- a/docs/reference/checkPermissivePrivacyControlLevel.html +++ b/docs/reference/checkPermissivePrivacyControlLevel.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,14 +49,16 @@

checkPermissivePrivacyControlLevel

Arguments

-
privacyControlLevels
+ + +
privacyControlLevels

is a vector of strings which contains the privacy control level names which are permitted by the calling method.

Details

Tests whether the R option "datashield.privacyControlLevel" is set to "permissive", if it isn't -will cause a call to stop() with the message "BLOCKED: The server is running in 'non-permissive' mode which +will cause a call to stop() with the message "BLOCKED: The server is running in 'non-permissive' mode which has caused this method to be blocked".

@@ -76,15 +78,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/classDS.html b/docs/reference/classDS.html index 676baf38..0217457d 100644 --- a/docs/reference/classDS.html +++ b/docs/reference/classDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Returns the class of an object

Arguments

-
x
+ + +
x

a string character, the name of an object

Value

- - -

the class of the input object

+

the class of the input object

Details

@@ -80,15 +80,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/colnamesDS.html b/docs/reference/colnamesDS.html index affb674a..f1158b30 100644 --- a/docs/reference/colnamesDS.html +++ b/docs/reference/colnamesDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Returns the column names of a data frame or matrix

Arguments

-
x
+ + +
x

a string character, the name of a dataframe or matrix

Value

- - -

the column names of the input object

+

the column names of the input object

Details

@@ -80,15 +80,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/completeCasesDS.html b/docs/reference/completeCasesDS.html index 078e0b5b..3a3c8e5f 100644 --- a/docs/reference/completeCasesDS.html +++ b/docs/reference/completeCasesDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,18 +51,18 @@

completeCasesDS: an assign function called by ds.completeCases

Arguments

-
x1.transmit
+ + +
x1.transmit

This argument determines the input data.frame, -matrix or vector from which rows with NAs are to be stripped. +matrix or vector from which rows with NAs are to be stripped. The <x1.transmit> argument is fully specified by the <x1> argument of the ds.completeCases function.

Value

- - -

a modified data.frame, matrix or vector from which +

a modified data.frame, matrix or vector from which all rows containing at least one NA have been deleted. This modified object is written to the serverside in each source. In addition, two validity messages are returned @@ -72,10 +72,8 @@

Value

ds.completeCases also returns any studysideMessages that can help 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 +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 studysideMessage from any datasource in which there was an error in creating <newobj> and a studysideMessage was saved. If there was no error and <newobj> was created without problems no studysideMessage will have been saved and ds.message("newobj") @@ -110,15 +108,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/corDS.html b/docs/reference/corDS.html index 68ff267f..9feffebd 100644 --- a/docs/reference/corDS.html +++ b/docs/reference/corDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,20 +51,20 @@

Computes the sum of each variable and the sum of products for each pair of v

Arguments

-
x
+ + +
x

a character, the name of a vector, matrix or dataframe of variables(s) for which the correlation(s) is (are) going to calculated for.

-
y
+
y

NULL (default) or the name of a vector, matrix or dataframe with compatible dimensions to x.

Value

- - -

a list that includes a matrix with elements the sum of products between each two variables, +

a list that includes a matrix with elements the sum of products between each two variables, a matrix with elements the sum of the values of each variable, a matrix with elements the number of complete cases in each pair of variables, a list with the number of missing values in each variable separately (columnwise) and the number of missing values casewise, and a vector with elements the @@ -95,15 +95,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/corTestDS.html b/docs/reference/corTestDS.html index 59ae5d54..5df46959 100644 --- a/docs/reference/corTestDS.html +++ b/docs/reference/corTestDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,25 +49,27 @@

Tests for correlation between paired samples

Arguments

-
x
+ + +
x

a character string providing the name of a numerical vector.

-
y
+
y

a character string providing the name of a numerical vector.

-
method
+
method

a character string indicating which correlation coefficient is to be used for the test. One of "pearson", "kendall", or "spearman", can be abbreviated.

-
exact
+
exact

a logical indicating whether an exact p-value should be computed. Used for Kendall's tau and Spearman's rho.

-
conf.level
+
conf.level

confidence level for the returned confidence interval. Currently only used for the Pearson product moment correlation coefficient if there are at least 4 complete pairs of observations.

@@ -75,9 +77,7 @@

Arguments

Value

- - -

the results of the correlation test.

+

the results of the correlation test.

Details

@@ -100,15 +100,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/covDS.html b/docs/reference/covDS.html index 857d31fb..81e634b5 100644 --- a/docs/reference/covDS.html +++ b/docs/reference/covDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,16 +51,18 @@

Computes the sum of each variable and the sum of products for each pair of v

Arguments

-
x
+ + +
x

a character, the name of a vector, matrix or dataframe of variable(s) for which the covariance(s) and the correlation(s) is (are) going to calculated for.

-
y
+
y

NULL (default) or the name of a vector, matrix or dataframe with compatible dimensions to x.

-
use
+
use

a character string giving a method for computing covariances in the presence of missing values. This must be one of the strings "casewise.complete" or "pairwise.complete". If use is set to 'casewise.complete' then any rows with missing values are omitted from the vector, matrix or dataframe before the @@ -71,9 +73,7 @@

Arguments

Value

- - -

a list that includes a matrix with elements the sum of products between each two variables, a matrix with +

a list that includes a matrix with elements the sum of products between each two variables, a matrix with elements the sum of the values of each variable, a matrix with elements the number of complete cases in each pair of variables, a list with the number of missing values in each variable separately (columnwise) and the number of missing values casewise or pairwise depending on the arqument use, and an error message which indicates @@ -105,15 +105,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/dataFrameDS.html b/docs/reference/dataFrameDS.html index 3246d1c3..3d5a7328 100644 --- a/docs/reference/dataFrameDS.html +++ b/docs/reference/dataFrameDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -61,22 +61,24 @@

dataFrameDS called by ds.dataFrame

Arguments

-
vectors
+ + +
vectors

a list which contains the elemental components to combine. These correspond to the vector of character strings specified in argument x of the clientside function ds.dataFrame()

-
r.names
+
r.names

NULL or a character vector specifying the names of the rows. Default NULL.

-
ch.rows
+
ch.rows

logical, if TRUE then the rows are checked for consistency of length and names. Default FALSE.

-
ch.names
+
ch.names

logical, if TRUE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names and are not duplicated. Default TRUE. In fact, the clientside function ensures no duplicated names can @@ -84,28 +86,26 @@

Arguments

but this argument is kept to check for other forms of syntactic validity.

-
clnames
+
clnames

a list of characters, the column names of the output data frame. These are generated by the clientside function from the names of vectors, and the column names of data.frames and matrices being combined in producing the output data.frame

-
strAsFactors
+
strAsFactors

logical, if TRUE determines whether character vectors should automatically be converted to factors? Default TRUE.

-
completeCases
+
completeCases

logical. If TRUE indicates that only complete cases should be included: any rows with missing values in any component will be excluded. Default FALSE.

Value

- - -

a dataframe composed of the specified elemental components will be created on the +

a dataframe composed of the specified elemental components will be created on the serverside and named according to the <newobj> argument of the clientside function ds.dataFrame()

@@ -139,15 +139,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/dataFrameFillDS.html b/docs/reference/dataFrameFillDS.html index 65cb5336..ffb9a6d7 100644 --- a/docs/reference/dataFrameFillDS.html +++ b/docs/reference/dataFrameFillDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -54,38 +54,38 @@

dataFrameFillDS

Arguments

-
df.name
+ + +
df.name

a character string representing the name of the input data frame that will be filled with extra columns with missing values if a number of variables is missing from it compared to the data frames of the other studies used in the analysis.

-
allNames.transmit
-

unique names of all the variables that are included in the input +

allNames.transmit
+

unique names of all the variables that are included in the input data frames from all the used datasources.

-
class.vect.transmit
-

the classes of all the variables that are included in the vector +

class.vect.transmit
+

the classes of all the variables that are included in the vector allNames.transmit.

-
levels.vec.transmit
+
levels.vec.transmit

the levels of all factor variables. The classes supported are 'numeric', 'integer', 'character', 'factor' and 'logical'.

Value

- - -

Nothing is returned to the client. The generated object is written to the serverside.

+

Nothing is returned to the client. The generated object is written to the serverside.

Details

This function checks if each study has all the variables compared to the other studies in the analysis. If a study does not have some of the variables, the function generates those -variables as vectors of missing values and combines them as columns to the input data frame. +variables as vectors of missing values and combines them as columns to the input data frame. Then, the "complete" in terms of the columns dataframe is saved in each server with a name specified by the argument newobj on the clientside.

@@ -106,15 +106,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/dataFrameSortDS.html b/docs/reference/dataFrameSortDS.html index 919a7854..4949efad 100644 --- a/docs/reference/dataFrameSortDS.html +++ b/docs/reference/dataFrameSortDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -54,14 +54,16 @@

Sorting and reordering data frames, vectors or matrices

Arguments

-
df.name
+ + +
df.name

a character string providing the name for the serverside data.frame to be sorted. This parameter is fully specified by the equivalent argument in ds.dataFrameShort and further details can be found at help("ds.dataFrameSort").

-
sort.key.name
+
sort.key.name

a character string providing the name for the sort key. This will be a serverside vector which may sit inside the data frame to be sorted or independently in the serverside analysis environment. But, if it @@ -70,14 +72,14 @@

Arguments

in ds.dataFrameShort and further details can be found at help("ds.dataFrameSort").

-
sort.descending
+
sort.descending

logical, if TRUE the data.frame will be sorted by the sort key in descending order. Default = FALSE (sort order ascending). This parameter is fully specified by the equivalent argument in ds.dataFrameShort and further details can be found at help("ds.dataFrameSort").

-
sort.method
+
sort.method

A character string taking one of the values: "default", "d", "alphabetic", "a", "numeric", "n", or NULL. Default value is "default". This parameter is fully specified by the equivalent argument @@ -86,9 +88,7 @@

Arguments

Value

- - -

the appropriately re-sorted data.frame will be written to the serverside +

the appropriately re-sorted data.frame will be written to the serverside R environment as a data.frame named according to the <newobj> argument(or with default name 'dataframesort.newobj') if no name is specified

@@ -120,15 +120,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/dataFrameSubsetDS1.html b/docs/reference/dataFrameSubsetDS1.html index da590510..7b21a17e 100644 --- a/docs/reference/dataFrameSubsetDS1.html +++ b/docs/reference/dataFrameSubsetDS1.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -57,20 +57,22 @@

dataFrameSubsetDS1 an aggregate function called by ds.dataFrameSubset

Arguments

-
df.name
+ + +
df.name

a character string providing the name for the data.frame to be sorted. <df.name> argument generated and passed directly to dataFrameSubsetDS1 by ds.dataFrameSubset

-
V1.name
+
V1.name

A character string specifying the name of a subsetting vector to which a Boolean operator will be applied to define the subset to be created. <V1.name> argument generated and passed directly to dataFrameSubsetDS1 by ds.dataFrameSubset

-
V2.name
+
V2.name

A character string specifying the name of the vector or scalar to which the values in the vector specified by the argument <V1.name> is to be compared. @@ -78,14 +80,14 @@

Arguments

dataFrameSubsetDS1 by ds.dataFrameSubset

-
Boolean.operator.n
+
Boolean.operator.n

A character string specifying one of six possible Boolean operators: '==', '!=', '>', '>=', '<', '<=' <Boolean.operator.n> argument generated and passed directly to dataFrameSubsetDS1 by ds.dataFrameSubset

-
keep.cols
+
keep.cols

a numeric vector specifying the numbers of the columns to be kept in the final subset when subsetting by column. For example: keep.cols=c(2:5,7,12) will keep columns 2,3,4,5,7 and 12. @@ -93,7 +95,7 @@

Arguments

dataFrameSubsetDS1 by ds.dataFrameSubset

-
rm.cols
+
rm.cols

a numeric vector specifying the numbers of the columns to be removed before creating the final subset when subsetting by column. For example: rm.cols=c(2:5,7,12) will remove columns 2,3,4,5,7 and 12. @@ -101,7 +103,7 @@

Arguments

dataFrameSubsetDS1 by ds.dataFrameSubset

-
keep.NAs
+
keep.NAs

logical, if TRUE any NAs in the vector holding the final Boolean vector indicating whether a given row should be included in the subset will be converted into 1s and so they will be included in the subset. Such NAs could be caused by NAs in @@ -113,9 +115,7 @@

Arguments

Value

- - -

This first serverside function called by ds.dataFrameSubset provides +

This first serverside function called by ds.dataFrameSubset provides first level traps for a comprehensive series of disclosure risks which can be returned directly to the clientside because dataFrameSubsetDS1 is an aggregate function. The second serverside function called by ds.dataFrameSubset @@ -146,15 +146,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/dataFrameSubsetDS2.html b/docs/reference/dataFrameSubsetDS2.html index 69a35b05..94f88494 100644 --- a/docs/reference/dataFrameSubsetDS2.html +++ b/docs/reference/dataFrameSubsetDS2.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -57,20 +57,22 @@

dataFrameSubsetDS2 an assign function called by ds.dataFrameSubset

Arguments

-
df.name
+ + +
df.name

a character string providing the name for the data.frame to be sorted. <df.name> argument generated and passed directly to dataFrameSubsetDS2 by ds.dataFrameSubset

-
V1.name
+
V1.name

A character string specifying the name of a subsetting vector to which a Boolean operator will be applied to define the subset to be created. <V1.name> argument generated and passed directly to dataFrameSubsetDS2 by ds.dataFrameSubset

-
V2.name
+
V2.name

A character string specifying the name of the vector or scalar to which the values in the vector specified by the argument <V1.name> is to be compared. @@ -78,14 +80,14 @@

Arguments

dataFrameSubsetDS2 by ds.dataFrameSubset

-
Boolean.operator.n
+
Boolean.operator.n

A character string specifying one of six possible Boolean operators: '==', '!=', '>', '>=', '<', '<=' <Boolean.operator.n> argument generated and passed directly to dataFrameSubsetDS2 by ds.dataFrameSubset

-
keep.cols
+
keep.cols

a numeric vector specifying the numbers of the columns to be kept in the final subset when subsetting by column. For example: keep.cols=c(2:5,7,12) will keep columns 2,3,4,5,7 and 12. @@ -93,7 +95,7 @@

Arguments

dataFrameSubsetDS2 by ds.dataFrameSubset

-
rm.cols
+
rm.cols

a numeric vector specifying the numbers of the columns to be removed before creating the final subset when subsetting by column. For example: rm.cols=c(2:5,7,12) will remove columns 2,3,4,5,7 and 12. @@ -101,7 +103,7 @@

Arguments

dataFrameSubsetDS2 by ds.dataFrameSubset

-
keep.NAs
+
keep.NAs

logical, if TRUE any NAs in the vector holding the final Boolean vector indicating whether a given row should be included in the subset will be converted into 1s and so they will be included in the subset. Such NAs could be caused by NAs in @@ -113,9 +115,7 @@

Arguments

Value

- - -

the object specified by the <newobj> argument (or default name '<df.name>_subset') +

the object specified by the <newobj> argument (or default name '<df.name>_subset') initially specified in calling ds.dataFrameSubset. The output object (the required subsetted data.frame called <newobj> is written to the serverside. In addition, two validity messages are returned via ds.dataFrameSubset @@ -125,10 +125,8 @@

Value

dataFrameSubsetDS2 (via 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 +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 studysideMessage from any datasource in which there was an error in creating <newobj> and a studysideMessage was saved. If there was no error and <newobj> was created without problems no studysideMessage will have been saved and ds.message("newobj") @@ -156,15 +154,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/densityGridDS.html b/docs/reference/densityGridDS.html index 5b5ac4d7..0fb63655 100644 --- a/docs/reference/densityGridDS.html +++ b/docs/reference/densityGridDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -58,45 +58,45 @@

Generates a density grid with or without a priori defined limits

Arguments

-
xvect
+ + +
xvect

a numerical vector

-
yvect
+
yvect

a numerical vector

-
limits
+
limits

a logical expression for whether or not limits of the density grid are defined by a user. If limits is set to "FALSE", min and max of xvect and yvect are used as a range. If limits is set to "TRUE", limits defined by x.min, x.max, y.min and y.max are used.

-
x.min
+
x.min

a minimum value for the x axis of the grid density object, if needed

-
x.max
+
x.max

a maximum value for the x axis of the grid density object, if needed

-
y.min
+
y.min

a minimum value for the y axis of the grid density object, if needed

-
y.max
+
y.max

a maximum value for the y axis of the grid density object, if needed

-
numints
+
numints

a number of intervals for the grid density object, by default is 20

Value

- - -

a grid density matrix

+

a grid density matrix

Details

@@ -120,15 +120,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/dimDS.html b/docs/reference/dimDS.html index 54982013..2954125a 100644 --- a/docs/reference/dimDS.html +++ b/docs/reference/dimDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Returns the dimension of a data frame or matrix

Arguments

-
x
+ + +
x

a string character, the name of a dataframe or matrix

Value

- - -

the dimension of the input object

+

the dimension of the input object

Details

@@ -80,15 +80,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/dmtC2SDS.html b/docs/reference/dmtC2SDS.html index aa3d6420..6e15d206 100644 --- a/docs/reference/dmtC2SDS.html +++ b/docs/reference/dmtC2SDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -60,14 +60,16 @@

Copy a clientside data.frame, matrix or tibble (DMT) to the serverside.

Arguments

-
dfdata.mat.transmit
+ + +
dfdata.mat.transmit

a character string in a format that can pass through the DataSHIELD R parser which specifies the name of the DMT to be copied from the clientside to the serverside. Value fully specified by <dfdata> argument of ds.dmtC2S.

-
inout.object.transmit
+
inout.object.transmit

a character string taking values "DF", "MAT" or "TBL". The value of this argument is automatically set by ds.dmtC2S depending on whether the clientside DMT is a data.frame, matrix or tibble. @@ -77,30 +79,30 @@

Arguments

but it works in all the test cases.

-
from
+
from

a character string specifying the source of <dfdata>. Fixed by clientside function as "clientside.matdftbl".

-
nrows.transmit
+
nrows.transmit

specifies the number of rows in the matrix to be created. Fixed by the clientside function as equal to the number of rows in the clientside DMT to be transferred.

-
ncols.transmit
+
ncols.transmit

specifies the number of columns in the matrix to be created. Fixed by the clientside function as equal to the number of columns in the clientside DMT to be transferred.

-
colnames.transmit
+
colnames.transmit

a parser-transmissable vector specifying the name of each column in the DMT being transferred from clientside to serverside. Generated automatically by clientside function from colnames of clientside DMT.

-
colclass.transmit
+
colclass.transmit

a parser-transmissable vector specifying the class of the vector representing each individual column in the DMT to be transferred. Generated automatically by clientside function. This allows the transmission of DMTs @@ -113,7 +115,7 @@

Arguments

forum and we can try to remedy the problem.

-
byrow
+
byrow

a logical value specifying whether the DMT created on the serverside should be filled row by row or column by column. This is fixed by the clientside function as FALSE (fill column by column).

@@ -121,9 +123,7 @@

Arguments

Value

- - -

the object specified by the <newobj> argument (or default name +

the object specified by the <newobj> argument (or default name "matdftbl.copied.C2S") which is written as a data.frame, matrix or tibble to the serverside.

@@ -149,15 +149,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/elsplineDS.html b/docs/reference/elsplineDS.html index fe03d072..509ef584 100644 --- a/docs/reference/elsplineDS.html +++ b/docs/reference/elsplineDS.html @@ -6,7 +6,7 @@ - +
@@ -32,13 +32,13 @@
- +
@@ -55,28 +55,28 @@

Basis for a piecewise linear spline with meaningful coefficients

Arguments

-
x
+ + +
x

the name of the input numeric variable

-
n
+
n

integer greater than 2, knots are computed such that they cut n equally-spaced intervals along the range of x

-
marginal
+
marginal

logical, how to parametrize the spline, see Details

-
names
+
names

character, vector of names for constructed variables

Value

- - -

an object of class "lspline" and "matrix", which its name is specified by the +

an object of class "lspline" and "matrix", which its name is specified by the newobj argument (or its default name "elspline.newobj"), is assigned on the serverside.

@@ -105,15 +105,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/extract.html b/docs/reference/extract.html index befb9f05..65be39be 100644 --- a/docs/reference/extract.html +++ b/docs/reference/extract.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Splits character by '$' and returns the single characters

Arguments

-
input
+ + +
input

a vector or a list of characters

Value

- - -

a vector of characters

+

a vector of characters

Details

@@ -76,15 +76,15 @@

Details

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/extractQuantilesDS1.html b/docs/reference/extractQuantilesDS1.html index cb610b60..9eb02602 100644 --- a/docs/reference/extractQuantilesDS1.html +++ b/docs/reference/extractQuantilesDS1.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,7 +51,9 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources and use of

Arguments

-
extract.quantiles
+ + +
extract.quantiles

one of a restricted set of character strings that fix the set of quantile values for which the corresponding values across all studies are to be estimated. For more details @@ -61,7 +63,7 @@

Arguments

<quantiles.for.estimation> in ds.ranksSecure.

-
extract.summary.output.ranks.df
+
extract.summary.output.ranks.df

character string specifying optional name for the data.frame written to the serverside on each data source that contains 5 of the key output variables from the ranking procedure pertaining @@ -75,9 +77,7 @@

Arguments

Value

- - -

as a first step in creating the vector of values of values of V2BR +

as a first step in creating the vector of values of values of V2BR that correspond to each quantile value, extractQuantilesDS1 identifies the two closest quantile values across all studies that span each key quantile value. These are saved as the data frame "closest.bounds.df" on the @@ -119,15 +119,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/extractQuantilesDS2.html b/docs/reference/extractQuantilesDS2.html index f452c305..0d9d21e1 100644 --- a/docs/reference/extractQuantilesDS2.html +++ b/docs/reference/extractQuantilesDS2.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,7 +51,9 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources and use of

Arguments

-
extract.summary.output.ranks.df
+ + +
extract.summary.output.ranks.df

character string specifies an optional name for the data.frame written to the serverside on each data source that contains 5 of the key output variables from the ranking procedure pertaining @@ -65,9 +67,7 @@

Arguments

Value

- - -

the single value of V2BR which best corresponds to each key quantile +

the single value of V2BR which best corresponds to each key quantile value to be estimated as specified by the argument <quantiles.for.estimation> A data frame (final.quantile.df)summarising the results of this analysis is written to the clientside. This data frame consists of two vectors. The @@ -83,7 +83,7 @@

Details

ds.ranksSecure. This takes the "global.bounds.df" data frame saved on the serverside following construction by extractQuantilesDS1. This data frame includes the two quantile values that most closely span each -quartile value to be estimated. If either of the values had been the correct +quartile value to be estimated. If either of the values had been the correct value for a given quantile, both the bounding values would have taken that value in global.bounds.df. This is because the upper bound was defined as the lowest value that was equal to or greater than the true value for that @@ -117,15 +117,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/gamlssDS.html b/docs/reference/gamlssDS.html index 2c4cd053..1a0645d6 100644 --- a/docs/reference/gamlssDS.html +++ b/docs/reference/gamlssDS.html @@ -1,15 +1,15 @@ -gamlssDS an aggregate function called by ds.galmss — gamlssDS • dsBase - +
@@ -35,23 +35,23 @@
- +
-

This function calls the gamlssDS that is a wrapper function from -the gamlss R package. The function returns an object of class "gamlss", which -is a generalized additive model for location, scale and shape (GAMLSS). The -function also saves the residuals as an object on the server-side with a name -specified by the newobj argument. In addition, if the argument centiles is set -to TRUE, the function calls the centiles function from the gamlss package and +

This function calls the gamlssDS that is a wrapper function from +the gamlss R package. The function returns an object of class "gamlss", which +is a generalized additive model for location, scale and shape (GAMLSS). The +function also saves the residuals as an object on the server-side with a name +specified by the newobj argument. In addition, if the argument centiles is set +to TRUE, the function calls the centiles function from the gamlss package and returns the sample percentages below each centile curve.

@@ -78,116 +78,116 @@

gamlssDS an aggregate function called by ds.galmss

Arguments

-
formula
-

a formula object, with the response on the left of an ~ operator, + + +

formula
+

a formula object, with the response on the left of an ~ operator, and the terms, separated by + operators, on the right. Nonparametric smoothing -terms are indicated by pb() for penalised beta splines, cs for smoothing splines, -lo for loess smooth terms and random or ra for random terms, +terms are indicated by pb() for penalised beta splines, cs for smoothing splines, +lo for loess smooth terms and random or ra for random terms, e.g. y~cs(x,df=5)+x1+x2*x3.

-
sigma.formula
+
sigma.formula

a formula object for fitting a model to the sigma parameter, as in the formula above, e.g. sigma.formula=~cs(x,df=5).

-
nu.formula
-

a formula object for fitting a model to the nu parameter, +

nu.formula
+

a formula object for fitting a model to the nu parameter, e.g. nu.formula=~x

-
tau.formula
-

a formula object for fitting a model to the tau parameter, +

tau.formula
+

a formula object for fitting a model to the tau parameter, e.g. tau.formula=~cs(x,df=2)

-
family
-

a gamlss.family object, which is used to define the distribution -and the link functions of the various parameters. The distribution families -supported by gamlss() can be found in gamlss.family. Functions such as BI() +

family
+

a gamlss.family object, which is used to define the distribution +and the link functions of the various parameters. The distribution families +supported by gamlss() can be found in gamlss.family. Functions such as BI() (binomial) produce a family object. Also can be given without the parentheses i.e. BI. Family functions can take arguments, as in BI(mu.link=probit).

-
data
-

a data frame containing the variables occurring in the formula. +

data
+

a data frame containing the variables occurring in the formula. If this is missing, the variables should be on the parent environment.

-
method
+
method

a character indicating the algorithm for GAMLSS. Can be either -'RS', 'CG' or 'mixed'. If method='RS' the function will use the Rigby and -Stasinopoulos algorithm, if method='CG' the function will use the Cole and +'RS', 'CG' or 'mixed'. If method='RS' the function will use the Rigby and +Stasinopoulos algorithm, if method='CG' the function will use the Cole and Green algorithm, and if method='mixed' the function will use the RS algorithm twice before switching to the Cole and Green algorithm for up to 10 extra iterations.

-
mu.fix
+
mu.fix

logical, indicate whether the mu parameter should be kept fixed in the fitting processes.

-
sigma.fix
+
sigma.fix

logical, indicate whether the sigma parameter should be kept fixed in the fitting processes.

-
nu.fix
-

logical, indicate whether the nu parameter should be kept fixed +

nu.fix
+

logical, indicate whether the nu parameter should be kept fixed in the fitting processes.

-
tau.fix
+
tau.fix

logical, indicate whether the tau parameter should be kept fixed in the fitting processes.

-
control
-

this sets the control parameters of the outer iterations algorithm -using the gamlss.control function. This is a vector of 7 numeric values: (i) c.crit -(the convergence criterion for the algorithm), (ii) n.cyc (the number of cycles of -the algorithm), (iii) mu.step (the step length for the parameter mu), (iv) sigma.step +

control
+

this sets the control parameters of the outer iterations algorithm +using the gamlss.control function. This is a vector of 7 numeric values: (i) c.crit +(the convergence criterion for the algorithm), (ii) n.cyc (the number of cycles of +the algorithm), (iii) mu.step (the step length for the parameter mu), (iv) sigma.step (the step length for the parameter sigma), (v) nu.step (the step length for the parameter nu), (vi) tau.step (the step length for the parameter tau), (vii) gd.tol -(global deviance tolerance level). The default values for these 7 parameters are +(global deviance tolerance level). The default values for these 7 parameters are set to c(0.001, 20, 1, 1, 1, 1, Inf).

-
i.control
-

this sets the control parameters of the inner iterations of the -RS algorithm using the glim.control function. This is a vector of 4 numeric values: -(i) cc (the convergence criterion for the algorithm), (ii) cyc (the number of -cycles of the algorithm), (iii) bf.cyc (the number of cycles of the backfitting -algorithm), (iv) bf.tol (the convergence criterion (tolerance level) for the -backfitting algorithm). The default values for these 4 parameters are set to +

i.control
+

this sets the control parameters of the inner iterations of the +RS algorithm using the glim.control function. This is a vector of 4 numeric values: +(i) cc (the convergence criterion for the algorithm), (ii) cyc (the number of +cycles of the algorithm), (iii) bf.cyc (the number of cycles of the backfitting +algorithm), (iv) bf.tol (the convergence criterion (tolerance level) for the +backfitting algorithm). The default values for these 4 parameters are set to c(0.001, 50, 30, 0.001).

-
centiles
-

logical, indicating whether the function centiles() will be used to +

centiles
+

logical, indicating whether the function centiles() will be used to tabulate the sample percentages below each centile curve. Default is set to FALSE.

-
xvar
-

the unique explanatory variable used in the centiles() function. This +

xvar
+

the unique explanatory variable used in the centiles() function. This variable is used only if the centiles argument is set to TRUE. A restriction in the centiles function is that it applies to models with one explanatory variable only.

-
newobj
+
newobj

a character string that provides the name for the output object that is stored on the data servers. Default gamlss_residuals.

Value

- - -

a gamlss object with all components as in the native R gamlss function. -Individual-level information like the components y (the response response) and -residuals (the normalised quantile residuals of the model) are not disclosed to +

a gamlss object with all components as in the native R gamlss function. +Individual-level information like the components y (the response response) and +residuals (the normalised quantile residuals of the model) are not disclosed to the client-side.

@@ -212,15 +212,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/getWGSRDS.html b/docs/reference/getWGSRDS.html index 68146af3..b8426410 100644 --- a/docs/reference/getWGSRDS.html +++ b/docs/reference/getWGSRDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,14 +51,16 @@

Computes the WHO Growth Reference z-scores of anthropometric data

Arguments

-
sex
+ + +
sex

the name of the binary variable that indicates the sex of the subject. This must be coded as 1 = male and 2 = female. If in your project the variable sex has different -levels, you should recode the levels to 1 for males and 2 for females using the +levels, you should recode the levels to 1 for males and 2 for females using the ds.recodeValues DataSHIELD function before the use of the ds.getWGSR.

-
firstPart
+
firstPart

Name of variable specifying:
Weight (kg) for BMI/A, W/A, W/H, or W/L
Head circumference (cm) for HC/A
@@ -71,7 +73,7 @@

Arguments

height, length, head circumference, and MUAC in cm, skinfolds in mm).

-
secondPart
+
secondPart

Name of variable specifying:
Age (days) for H/A, HC/A, L/A, MUAC/A, SSF/A, or TSF/A
Height (cm) for BMI/A, or W/H
@@ -80,7 +82,7 @@

Arguments

height and length in cm).

-
index
+
index

The index to be calculated and added to data. One of:
bfa BMI for age
hca Head circumference for age
@@ -95,23 +97,21 @@

Arguments

Give a quoted index name as in (e.g.) "wfh".

-
standing
+
standing

Variable specifying how stature was measured. If NA (default) then age (for "hfa" or "lfa") or height rules (for "wfh" or "wfl") will be applied. This must be coded as -1 = Standing; 2 = Supine; 3 = Unknown. Missing values will be recoded to 3 = Unknown. +1 = Standing; 2 = Supine; 3 = Unknown. Missing values will be recoded to 3 = Unknown. Give a single value (e.g."1"). If no value is specified then height and age rules will be applied.

-
thirdPart
+
thirdPart

Name of variable specifying age (in days) for BMI/A. Give a quoted variable name as in (e.g.) "age". Be careful with units (age in days).

Value

- - -

ds.getWGSR assigns a numeric vector that includes the z-scores for the +

ds.getWGSR assigns a numeric vector that includes the z-scores for the specified index.

@@ -120,7 +120,7 @@

Details

weight, height or length, MUAC, head circumference, sub-scapular skinfold and triceps skinfold. Note that the function might fail or return NAs when the variables are outside the ranges given in the WGS (WHO Child Growth Standards) reference (i.e. 45 to 120 cm for height and -0 to 60 months for age). It is up to the user to check the ranges and the units of their +0 to 60 months for age). It is up to the user to check the ranges and the units of their data.

@@ -140,15 +140,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmDS1.html b/docs/reference/glmDS1.html index 2d76323d..1b8fccfa 100644 --- a/docs/reference/glmDS1.html +++ b/docs/reference/glmDS1.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,25 +49,27 @@

glmDS1 called by ds.glm

Arguments

-
formula
+ + +
formula

a glm() formula consistent with R syntax eg U~x+y+Z to regress variables U on x,y and Z

-
family
+
family

a glm() family consistent with R syntax eg "gaussian", "poisson", "binomial"

-
weights
+
weights

an optional variable providing regression weights

-
offset
+
offset

the offset

-
data
+
data

an optional character string specifying a data.frame object holding the data to be analysed under the specified model

@@ -98,15 +100,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmDS2.html b/docs/reference/glmDS2.html index 416cb547..21bf346d 100644 --- a/docs/reference/glmDS2.html +++ b/docs/reference/glmDS2.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,30 +49,32 @@

glmDS2 called by ds.glm

Arguments

-
formula
+ + +
formula

a glm() formula consistent with R syntax eg U~x+y+Z to regress variables U on x, y and Z

-
family
+
family

a glm() family consistent with R syntax eg "gaussian", "poisson", "binomial"

-
beta.vect
+
beta.vect

a numeric vector created by the clientside function specifying the vector of regression coefficients at the current iteration

-
offset
+
offset

an optional variable providing a regression offset

-
weights
+
weights

an optional variable providing regression weights

-
dataName
+
dataName

an optional character string specifying a data.frame object holding the data to be analysed under the specified model same

@@ -104,15 +106,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmPredictDS.ag.html b/docs/reference/glmPredictDS.ag.html index 83962605..7713d327 100644 --- a/docs/reference/glmPredictDS.ag.html +++ b/docs/reference/glmPredictDS.ag.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -61,39 +61,41 @@

predict regression responses from a glm object

Arguments

-
glmname.transmit
+ + +
glmname.transmit

a character string specifying the name of the glm object on the serverside that is to be used for prediction. Fully specified by glmname argument in ds.glmPredict

-
newdataname.transmit
+
newdataname.transmit

a character string specifying an (optional) dataframe on the serverside in which to look for (potentially) new covariate values on which to base the predictions. Fully specified by newdataname argument in ds.glmPredict.

-
output.type
+
output.type

a character string taking the values 'response', 'link' or 'terms'. Fully specified by corresponding argument in ds.glmPredict.

-
se.fit
+
se.fit

logical if standard errors for the fitted predictions are required. Fully specified by corresponding argument in ds.glmPredict.

-
dispersion
+
dispersion

numeric value specifying the dispersion of the GLM fit to be assumed in computing the standard errors. Fully specified by corresponding argument in ds.glmPredict.

-
terms.transmit
+
terms.transmit

a character vector specifying a subset of terms to return in the prediction. Fully specified by 'terms' argument in ds.glmPredict.

-
na.action
+
na.action

character string determining what should be done with missing values in the data.frame identified by <newdataname.transmit>. Fully specified by na.action argument in ds.glmPredict.

@@ -101,9 +103,7 @@

Arguments

Value

- - -

components/summarising statistics of a serverside predict_glm object +

components/summarising statistics of a serverside predict_glm object that can safely be transmitted to the clientside without a risk of disclosure. For further details see DataSHIELD help for ds.glmPredict and glmPredict.as and help in native R for predict.glm @@ -137,15 +137,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmPredictDS.as.html b/docs/reference/glmPredictDS.as.html index 1de16372..3ff37f20 100644 --- a/docs/reference/glmPredictDS.as.html +++ b/docs/reference/glmPredictDS.as.html @@ -1,12 +1,12 @@ predict regression responses from a glm object — glmPredictDS.as • dsBase - +
@@ -32,20 +32,20 @@
- +

create a predict_glm object on the serverside by applying the equivalent of predict.glm() in native R to a glm object on the serverside. -Identify and return components of the predict_glm object +Identify and return components of the predict_glm object that can safely be sent to the clientside without a risk of disclosure

@@ -63,39 +63,41 @@

predict regression responses from a glm object

Arguments

-
glmname.transmit
+ + +
glmname.transmit

a character string specifying the name of the glm object on the serverside that is to be used for prediction. Fully specified by glmname argument in ds.glmPredict

-
newdataname.transmit
+
newdataname.transmit

a character string specifying an (optional) dataframe on the serverside in which to look for (potentially) new covariate values on which to base the predictions. Fully specified by newdataname argument in ds.glmPredict.

-
output.type
+
output.type

a character string taking the values 'response', 'link' or 'terms'. Fully specified by corresponding argument in ds.glmPredict.

-
se.fit
+
se.fit

logical if standard errors for the fitted predictions are required. Fully specified by corresponding argument in ds.glmPredict.

-
dispersion
+
dispersion

numeric value specifying the dispersion of the GLM fit to be assumed in computing the standard errors. Fully specified by corresponding argument in ds.glmPredict.

-
terms.transmit
+
terms.transmit

a character vector specifying a subset of terms to return in the prediction. Fully specified by 'terms' argument in ds.glmPredict.

-
na.action
+
na.action

character string determining what should be done with missing values in the data.frame identified by <newdataname.transmit>. Fully specified by na.action argument in ds.glmPredict.

@@ -103,9 +105,7 @@

Arguments

Value

- - -

glmPredict.as writes a new object to the serverside containing +

glmPredict.as writes a new object to the serverside containing output precisely equivalent to the output from predict.glm in native R. For more details see DataSHIELD help for ds.glmPredict and help for predict.glm in native R

@@ -136,15 +136,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmSLMADS.assign.html b/docs/reference/glmSLMADS.assign.html index f8323e19..cb539a6f 100644 --- a/docs/reference/glmSLMADS.assign.html +++ b/docs/reference/glmSLMADS.assign.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,34 +51,34 @@

Fit a Generalized Linear Model (GLM) with pooling via Study Level Meta-Analy

Arguments

-
formula
+ + +
formula

a glm formula, specified in call to ds.glmSLMA

-
family
+
family

a glm family, specified in call to ds.glmSLMA

-
offsetName
+
offsetName

a character string specifying a variable to be used as an offset. Specified in call to ds.glmSLMA.

-
weightsName
+
weightsName

a character string specifying a variable to be used as regression weights. Specified in call to ds.glmSLMA. Specified in call to ds.glmSLMA.

-
dataName
+
dataName

a character string specifying the name of a data.frame holding the data for the model. Specified in call to ds.glmSLMA.

Value

- - -

writes glm object summarising the fitted model to the serverside. +

writes glm object summarising the fitted model to the serverside. For more detailed information see help for ds.glmSLMA.

@@ -104,15 +104,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmSLMADS1.html b/docs/reference/glmSLMADS1.html index 5434c119..024b209a 100644 --- a/docs/reference/glmSLMADS1.html +++ b/docs/reference/glmSLMADS1.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,34 +51,34 @@

Fit a Generalized Linear Model (GLM) with pooling via Study Level Meta-Analy

Arguments

-
formula
+ + +
formula

a glm formula, specified in call to ds.glmSLMA

-
family
+
family

a glm family, specified in call to ds.glmSLMA

-
weights
+
weights

a character string specifying a variable to be used as regression weights. Specified in call to ds.glmSLMA. Specified in call to ds.glmSLMA.

-
offset
+
offset

a character string specifying a variable to be used as an offset. Specified in call to ds.glmSLMA.

-
data
+
data

a character string specifying the name of a data.frame holding the data for the model. Specified as dataName in call to ds.glmSLMA.

Value

- - -

assesses and returns information about failure to pass disclosure traps +

assesses and returns information about failure to pass disclosure traps such as test of model complexity (saturation). For more detailed information see help for ds.glmSLMA.

@@ -106,15 +106,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmSLMADS2.html b/docs/reference/glmSLMADS2.html index d484ed5c..f2301b0b 100644 --- a/docs/reference/glmSLMADS2.html +++ b/docs/reference/glmSLMADS2.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,41 +51,41 @@

Fit a Generalized Linear Model (GLM) with pooling via Study Level Meta-Analy

Arguments

-
formula
+ + +
formula

a glm formula, specified in call to ds.glmSLMA

-
family
+
family

a glm family, specified in call to ds.glmSLMA

-
offset
+
offset

a character string specifying a variable to be used as an offset. Specified in call to ds.glmSLMA.

-
weights
+
weights

a character string specifying a variable to be used as regression weights. Specified in call to ds.glmSLMA. Specified in call to ds.glmSLMA.

-
newobj
+
newobj

a character string specifying the name of the glm object written to the serverside by glmSLMADS.assign. This is either the name specified by the newobj argument in ds.glmSLMA or if newobj was unspecified or NULL it is called new.glm.obj.

-
dataName
+
dataName

a character string specifying the name of a data.frame holding the data for the model. Specified in call to ds.glmSLMA.

Value

- - -

All quantitative, Boolean, and character objects required to +

All quantitative, Boolean, and character objects required to enable the SLMA pooling of the separate glm models fitted to each study - in particular including the study-specific regression coefficients and their corresponding standard errors.

@@ -114,15 +114,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmSummaryDS.ag.html b/docs/reference/glmSummaryDS.ag.html index 9f68f002..abe309b2 100644 --- a/docs/reference/glmSummaryDS.ag.html +++ b/docs/reference/glmSummaryDS.ag.html @@ -1,11 +1,11 @@ -summarize a glm object on the serverside — glmSummaryDS.ag • dsBasesummarize a glm object on the serverside — glmSummaryDS.ag • dsBase - +
@@ -31,18 +31,18 @@
- +
-

returns the non-disclosive elements to the clientside of a +

returns the non-disclosive elements to the clientside of a glm object and the corresponding object holding the output of summary(glm object) on the serverside.

@@ -53,7 +53,9 @@

summarize a glm object on the serverside

Arguments

-
x.transmit
+ + +
x.transmit

a character string specifying the name of the glm object on the serverside that is to be summarised. This is specified by x.name argument in ds.glmSummary

@@ -61,9 +63,7 @@

Arguments

Value

- - -

returns to the clientside all of the non-disclosive +

returns to the clientside all of the non-disclosive elements (and only the non-disclosive elements) of a specified serverside glm and its corresponding summary_glm object.

@@ -71,7 +71,7 @@

Value

Details

Serverside aggregate function called by ds.glmSummary. ds.glmSummary first calls glmSummaryDS.ag to create a glm_summary -object on the serverside based on applying native R's summary.glm() to a +object on the serverside based on applying native R's summary.glm() to a serverside glm object previously created by ds.glmSLMA. Then it calls glmSummaryDS.ag to return to the clientside all of the non-disclosive elements (and only the non-disclosive elements) of the serverside glm @@ -94,15 +94,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmSummaryDS.as.html b/docs/reference/glmSummaryDS.as.html index d13925b0..1a9f51f6 100644 --- a/docs/reference/glmSummaryDS.as.html +++ b/docs/reference/glmSummaryDS.as.html @@ -1,12 +1,12 @@ -summarize a glm object on the serverside — glmSummaryDS.as • dsBasesummarize a glm object on the serverside — glmSummaryDS.as • dsBase - +
@@ -32,20 +32,20 @@
- +
-

summarize a glm object on the serverside to create a -summary_glm object. Also identify and return components of -both the glm object and the summary_glm object +

summarize a glm object on the serverside to create a +summary_glm object. Also identify and return components of +both the glm object and the summary_glm object that can safely be sent to the clientside without a risk of disclosure

@@ -55,7 +55,9 @@

summarize a glm object on the serverside

Arguments

-
x.transmit
+ + +
x.transmit

a character string specifying the name of the glm object on the serverside that is to be summarised. This is specified by x.name argument in ds.glmSummary

@@ -63,9 +65,7 @@

Arguments

Value

- - -

writes object to serverside which is precisely equivalent +

writes object to serverside which is precisely equivalent to summary(glm object) in native R

@@ -93,15 +93,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmerSLMADS.assign.html b/docs/reference/glmerSLMADS.assign.html index 2917ff4a..07b70151 100644 --- a/docs/reference/glmerSLMADS.assign.html +++ b/docs/reference/glmerSLMADS.assign.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -63,64 +63,64 @@

Fitting generalized linear mixed effect models - serverside function

Arguments

-
formula
+ + +
formula

see help for ds.glmerSLMA

-
offset
+
offset

see help for ds.glmerSLMA

-
weights
+
weights

see help for ds.glmerSLMA

-
dataName
+
dataName

see help for ds.glmerSLMA

-
family
+
family

see help for ds.glmerSLMA

-
control_type
+
control_type

see help for ds.glmerSLMA

-
control_value.transmit
+
control_value.transmit

see help for argument <control_value> for function ds.glmerSLMA

-
nAGQ
+
nAGQ

integer scalar, defaulting to 1L. IN PRACTICE, IT MAY BE NECESSARY TO SET nAGQ TO 0L when the model appears to converge perfectly well (e.g. verbose=2 demonstrates good initial convergence of both the log-likelihood and -regression coefficients) but formal convergence does not get declared - +regression coefficients) but formal convergence does not get declared - so no output is produced - despite running the model for many iterations. The nAGQ argument is set by the nAGQ argument for ds.glmerSLMA and further details can be found in help(ds.glmerSLMA) and in the native R help for glmer()

-
verbose
+
verbose

see help for ds.glmerSLMA

-
theta
+
theta

see help for argument <start_theta> for function ds.glmerSLMA

-
fixef
+
fixef

see help for argument <start_fixef> for function ds.glmerSLMA

Value

- - -

writes glmerMod object summarising the fitted model to the serverside. +

writes glmerMod object summarising the fitted model to the serverside. For more detailed information see help for ds.glmerSLMA.

@@ -148,15 +148,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/glmerSLMADS2.html b/docs/reference/glmerSLMADS2.html index 61bc5050..99b208b4 100644 --- a/docs/reference/glmerSLMADS2.html +++ b/docs/reference/glmerSLMADS2.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -65,64 +65,64 @@

Fitting generalized linear mixed effect models - serverside function

Arguments

-
formula
+ + +
formula

see help for ds.glmerSLMA

-
offset
+
offset

see help for ds.glmerSLMA

-
weights
+
weights

see help for ds.glmerSLMA

-
dataName
+
dataName

see help for ds.glmerSLMA

-
family
+
family

see help for ds.glmerSLMA

-
control_type
+
control_type

see help for ds.glmerSLMA

-
control_value.transmit
+
control_value.transmit

see help for argument <control_value> for function ds.glmerSLMA

-
nAGQ
+
nAGQ

integer scalar, defaulting to 1L. IN PRACTICE, IT MAY BE NECESSARY TO SET nAGQ TO 0L when the model appears to converge perfectly well (e.g. verbose=2 demonstrates good initial convergence of both the log-likelihood and -regression coefficients) but formal convergence does not get declared - +regression coefficients) but formal convergence does not get declared - so no output is produced - despite running the model for many iterations. The nAGQ argument is set by the nAGQ argument for ds.glmerSLMA and further details can be found in help(ds.glmerSLMA) and in the native R help for glmer()

-
verbose
+
verbose

see help for ds.glmerSLMA

-
theta
+
theta

see help for argument <start_theta> for function ds.glmerSLMA

-
fixef
+
fixef

see help for argument <start_fixef> for function ds.glmerSLMA

Value

- - -

all key model components see help for ds.glmerSLMA

+

all key model components see help for ds.glmerSLMA

Details

@@ -136,7 +136,7 @@

Details

using study level meta-analysis (SLMA). By default the SLMA is undertaken using the metafor package, but as the SLMA occurs on the clientside which, as far as the user is concerned is just a standard R environment, the user can choose to use -any approach to meta-analysis they choose. Additional information about fitting +any approach to meta-analysis they choose. Additional information about fitting glmes using the glmer engine can be obtained using R help for glmer and the lme4 package

@@ -156,15 +156,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/heatmapPlotDS.html b/docs/reference/heatmapPlotDS.html index 60c5d316..90bc889a 100644 --- a/docs/reference/heatmapPlotDS.html +++ b/docs/reference/heatmapPlotDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,40 +49,40 @@

Calculates the coordinates of the centroid of each n nearest neighbours

Arguments

-
x
+ + +
x

the name of a numeric vector, the x-variable.

-
y
+
y

the name of a numeric vector, the y-variable.

-
k
-

the number of the nearest neghbours for which their centroid is calculated if the +

k
+

the number of the nearest neghbours for which their centroid is calculated if the method.indicator is equal to 1 (i.e. deterministic method).

-
noise
+
noise

the percentage of the initial variance that is used as the variance of the embedded noise if the method.indicator is equal to 2 (i.e. probabilistic method).

-
method.indicator
+
method.indicator

a number equal to either 1 or 2. If the value is equal to 1 then the 'deterministic' method is used. If the value is set to 2 the 'probabilistic' method is used.

Value

- - -

a list with the x and y coordinates of the centroids if the deterministic method is used +

a list with the x and y coordinates of the centroids if the deterministic method is used or the x and y coordinated of the noisy data if the probabilistic method is used.

Details

The function finds the n-1 nearest neighbours of each data point in a 2-dimensional space. -The nearest neighbours are the data points with the minimum Euclidean distances from the point of +The nearest neighbours are the data points with the minimum Euclidean distances from the point of interest. Each point of interest and its n-1 nearest neighbours are then used for the calculation of the coordinates of the centroid of those n points. Centroid here is referred to the centre of mass, i.e. the x-coordinate of the centroid is the average value of the x-coordinates of the n nearest @@ -107,15 +107,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/hetcorDS.html b/docs/reference/hetcorDS.html index b06533b1..21fd9239 100644 --- a/docs/reference/hetcorDS.html +++ b/docs/reference/hetcorDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,42 +49,42 @@

Heterogeneous Correlation Matrix

Arguments

-
data
+ + +
data

the name of a data frame consisting of factors, ordered factors, logical variables, character variables, and/or numeric variables, or the first of several variables.

-
ML
+
ML

if TRUE, compute maximum-likelihood estimates; if FALSE (default), compute quick two-step estimates.

-
std.err
+
std.err

if TRUE (default), compute standard errors.

-
bins
+
bins

number of bins to use for continuous variables in testing bivariate normality; the default is 4.

-
pd
+
pd

if TRUE (default) and if the correlation matrix is not positive-definite, an attempt will be made to adjust it to a positive-definite matrix, using the nearPD function in the Matrix package. Note that default arguments to nearPD are used (except corr=TRUE); for more control call nearPD directly.

-
use
+
use

if "complete.obs", remove observations with any missing data; if "pairwise.complete.obs", compute each correlation using all observations with valid data for that pair of variables.

Value

- - -

Returns an object of class "hetcor" with the following components: the correlation matrix; +

Returns an object of class "hetcor" with the following components: the correlation matrix; the type of each correlation: "Pearson", "Polychoric", or "Polyserial"; the standard errors of the correlations, if requested; the number (or numbers) of observations on which the correlations are based; p-values for tests of bivariate normality for each pair of variables; the method by which @@ -114,15 +114,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/histogramDS1.html b/docs/reference/histogramDS1.html index f11afaaa..4b82e6de 100644 --- a/docs/reference/histogramDS1.html +++ b/docs/reference/histogramDS1.html @@ -1,15 +1,15 @@ returns the minimum and the maximum of the input numeric vector — histogramDS1 • dsBase - +
@@ -35,21 +35,21 @@
- +

this function returns the minimum and maximum of the input numeric vector which -depends on the argument method.indicator. If the method.indicator is set to 1 (i.e. the +depends on the argument method.indicator. If the method.indicator is set to 1 (i.e. the 'smallCellsRule' is used) the computed minimum and maximum values are multiplied by a very small -random number. If the method.indicator is set to 2 (i.e. the 'deteministic' method is used) the +random number. If the method.indicator is set to 2 (i.e. the 'deteministic' method is used) the function returns the minimum and maximum values of the vector with the scaled centroids. If the method.indicator is set to 3 (i.e. the 'probabilistic' method is used) the function returns the minimum and maximum values of the generated 'noisy' vector.

@@ -61,32 +61,32 @@

returns the minimum and the maximum of the input numeric vector

Arguments

-
xvect
+ + +
xvect

the numeric vector for which the histogram is desired.

-
method.indicator
+
method.indicator

a number equal to either 1, 2 or 3 indicating the method of disclosure control that is used for the generation of the histogram. If the value is equal to 1 then the 'smallCellsRule' is used. If the value is equal to 2 then the 'deterministic' method is used. If the value is set to 3 then the 'probabilistic' method is used.

-
k
-

the number of the nearest neghbours for which their centroid is calculated if the +

k
+

the number of the nearest neghbours for which their centroid is calculated if the method.indicator is equal to 2 (i.e. deterministic method).

-
noise
+
noise

the percentage of the initial variance that is used as the variance of the embedded noise if the method.indicator is equal to 3 (i.e. probabilistic method).

Value

- - -

a numeric vector which contains the minimum and the maximum values of the vector

+

a numeric vector which contains the minimum and the maximum values of the vector

Author

@@ -105,15 +105,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/histogramDS2.html b/docs/reference/histogramDS2.html index 5d1b0e78..5070bb11 100644 --- a/docs/reference/histogramDS2.html +++ b/docs/reference/histogramDS2.html @@ -2,12 +2,12 @@ Computes a histogram of the input variable without plotting. — histogramDS2 • dsBase - +
@@ -33,13 +33,13 @@
- +
@@ -47,7 +47,7 @@

Computes a histogram of the input variable without plotting.

This function produces the information required to plot a histogram. This is done without allowing for bins (cells) with number of counts less than the pre-specified disclosure control set for the minimum cell -size of a table. If a bin has less counts than this threshold then their counts +size of a table. If a bin has less counts than this threshold then their counts and its density are replaced by a 0 value.

@@ -57,44 +57,44 @@

Computes a histogram of the input variable without plotting.

Arguments

-
xvect
+ + +
xvect

the numeric vector for which the histogram is desired.

-
num.breaks
+
num.breaks

the number of breaks that the range of the variable is divided.

-
min
+
min

a numeric, the lower limit of the distribution.

-
max
+
max

a numeric, the upper limit of the distribution.

-
method.indicator
+
method.indicator

a number equal to either 1, 2 or 3 indicating the method of disclosure control that is used for the generation of the histogram. If the value is equal to 1 then the 'smallCellsRule' is used. If the value is equal to 2 then the 'deterministic' method is used. If the value is set to 3 then the 'probabilistic' method is used.

-
k
-

the number of the nearest neghbours for which their centroid is calculated if the +

k
+

the number of the nearest neghbours for which their centroid is calculated if the method.indicator is equal to 2 (i.e. deterministic method).

-
noise
+
noise

the percentage of the initial variance that is used as the variance of the embedded noise if the method.indicator is equal to 3 (i.e. probabilistic method).

Value

- - -

a list with an object of class histogram and the number of invalid cells

+

a list with an object of class histogram and the number of invalid cells

Details

@@ -117,15 +117,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/igb_standardsDS.html b/docs/reference/igb_standardsDS.html index 19ddc828..9d15b17a 100644 --- a/docs/reference/igb_standardsDS.html +++ b/docs/reference/igb_standardsDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -57,48 +57,48 @@

Converts birth measurements to intergrowth z-scores/centiles

Arguments

-
gagebrth
+ + +
gagebrth

the name of the "gestational age at birth in days" variable.

-
z
+
z

z-score(s) to convert (must be between 0 and 1). Default value is 0. This value is used only if fun is set to "igb_zscore2value".

-
p
-

centile(s) to convert (must be between 0 and 100). Default value is p=50. +

p
+

centile(s) to convert (must be between 0 and 100). Default value is p=50. This value is used only if fun is set to "igb_centile2value".

-
val
+
val

the name of the anthropometric variable to convert.

-
var
+
var

the name of the measurement to convert ("lencm", "wtkg", "hcircm", "wlr")

-
sex
+
sex

the name of the sex factor variable. The variable should be coded as Male/Female. -If it is coded differently (e.g. 0/1), then you can use the ds.recodeValues function to +If it is coded differently (e.g. 0/1), then you can use the ds.recodeValues function to recode the categories to Male/Female before the use of ds.igb_standards

-
fun
+
fun

the name of the function to be used. This can be one of: "igb_centile2value", "igb_zscore2value", "igb_value2zscore" (default), "igb_value2centile".

Value

- - -

assigns the converted measurement as a new object on the server-side

+

assigns the converted measurement as a new object on the server-side

Note

-

For gestational ages between 24 and 33 weeks, the INTERGROWTH very early preterm +

For gestational ages between 24 and 33 weeks, the INTERGROWTH very early preterm standard is used.

@@ -118,15 +118,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/index.html b/docs/reference/index.html index d033cb10..591b8687 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,9 +1,9 @@ -Function reference • dsBasePackage index • dsBase - +
@@ -29,7 +29,7 @@
- +
@@ -586,15 +586,15 @@

All functions
-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/isNaDS.html b/docs/reference/isNaDS.html index b7623c04..88c13303 100644 --- a/docs/reference/isNaDS.html +++ b/docs/reference/isNaDS.html @@ -1,10 +1,10 @@ -Checks if a vector is empty — isNaDS • dsBaseChecks if a vector is empty — isNaDS • dsBase - +
@@ -30,18 +30,18 @@
- +
-

this function is similar to R function is.na but instead of a vector +

this function is similar to R function is.na but instead of a vector of booleans it returns just one boolean to tell if all the element are missing values.

@@ -51,15 +51,15 @@

Checks if a vector is empty

Arguments

-
xvect
+ + +
xvect

a numerical or character vector

Value

- - -

the integer '1' if the vector contains on NAs and '0' otherwise

+

the integer '1' if the vector contains on NAs and '0' otherwise

Author

@@ -78,15 +78,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/isValidDS.html b/docs/reference/isValidDS.html index e5ef025e..0fce3578 100644 --- a/docs/reference/isValidDS.html +++ b/docs/reference/isValidDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Checks if an input is valid

Arguments

-
obj,
+ + +
obj,

a vector (numeric, integer, factor, character), data.frame or matrix

Value

- - -

a boolean, TRUE if input is valid or FALSE if not.

+

a boolean, TRUE if input is valid or FALSE if not.

Details

@@ -80,15 +80,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/kurtosisDS1.html b/docs/reference/kurtosisDS1.html index d13f0e0e..1e588fe0 100644 --- a/docs/reference/kurtosisDS1.html +++ b/docs/reference/kurtosisDS1.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,25 +49,25 @@

Calculates the kurtosis of a numeric variable

Arguments

-
x
+ + +
x

a string character, the name of a numeric variable.

-
method
+
method

an integer between 1 and 3 selecting one of the algorithms for computing kurtosis detailed in the headers of the client-side ds.kurtosis function.

Value

- - -

a list including the kurtosis of the input numeric variable, the number of valid observations and +

a list including the kurtosis of the input numeric variable, the number of valid observations and the study-side validity message.

Details

-

The function calculates the kurtosis of an input variable x with three different methods. +

The function calculates the kurtosis of an input variable x with three different methods. The method is specified by the argument method in the client-side ds.kurtosis function.

@@ -87,15 +87,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/kurtosisDS2.html b/docs/reference/kurtosisDS2.html index 10ccc788..285d71f5 100644 --- a/docs/reference/kurtosisDS2.html +++ b/docs/reference/kurtosisDS2.html @@ -1,10 +1,10 @@ -Calculates the kurtosis of a numeric variable — kurtosisDS2 • dsBaseCalculates the kurtosis of a numeric variable — kurtosisDS2 • dsBase - +
@@ -30,18 +30,18 @@
- +
-

This function calculates summary statistics that are returned to the client-side and +

This function calculates summary statistics that are returned to the client-side and used for the estimation of the combined kurtosis of a numeric variable across all studies.

@@ -51,22 +51,22 @@

Calculates the kurtosis of a numeric variable

Arguments

-
x
+ + +
x

a string character, the name of a numeric variable.

-
global.mean
+
global.mean

a numeric, the combined mean of the input variable across all studies.

Value

- - -

a list including the sum of quartic differences between the values of x and the global mean of x across +

a list including the sum of quartic differences between the values of x and the global mean of x across all studies, the sum of squared differences between the values of x and the global mean of x across all studies, -the number of valid observations (i.e. the length of x after excluding missing values), and a validity message -indicating indicating a valid analysis if the number of valid observations are above the protection filter +the number of valid observations (i.e. the length of x after excluding missing values), and a validity message +indicating indicating a valid analysis if the number of valid observations are above the protection filter nfilter.tab or invalid analysis otherwise.

@@ -92,15 +92,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/lengthDS.html b/docs/reference/lengthDS.html index e94d5831..0b574b1a 100644 --- a/docs/reference/lengthDS.html +++ b/docs/reference/lengthDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Returns the length of a vector or list

Arguments

-
x
+ + +
x

a string character, the name of a vector or list

Value

- - -

a numeric, the number of elements of the input vector or list.

+

a numeric, the number of elements of the input vector or list.

Details

@@ -80,15 +80,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/levelsDS.html b/docs/reference/levelsDS.html index 782b4d65..f49f4a87 100644 --- a/docs/reference/levelsDS.html +++ b/docs/reference/levelsDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Returns the levels of a factor vector

Arguments

-
x
+ + +
x

a factor vector

Value

- - -

a list, the factor levels present in the vector

+

a list, the factor levels present in the vector

Details

@@ -80,15 +80,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/lexisDS1.html b/docs/reference/lexisDS1.html index 20c91467..38770bdd 100644 --- a/docs/reference/lexisDS1.html +++ b/docs/reference/lexisDS1.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,7 +49,9 @@

lexisDS1

Arguments

-
exitCol
+ + +
exitCol

a character string specifying the variable holding the time that each individual is censored or fails

@@ -75,15 +77,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/lexisDS2.html b/docs/reference/lexisDS2.html index 4cfc067f..8e3074dd 100644 --- a/docs/reference/lexisDS2.html +++ b/docs/reference/lexisDS2.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -58,45 +58,47 @@

lexisDS2

Arguments

-
datatext
+ + +
datatext

a clientside provided character string specifying the data.frame holding the data set to be expanded

-
intervalWidth
+
intervalWidth

a clientside generated character string specifying the width of the survival epochs in the expanded data

-
maxmaxtime
+
maxmaxtime

a clientside generated object specifying the maximum follow up time in any of the sources

-
idCol
+
idCol

a clientside generated character string specifying the variable holding the IDs of indivuals in the data set to be expanded

-
entryCol
+
entryCol

a clientside specified character string identifying the variable holding the time that each individual starts follow up

-
exitCol
+
exitCol

a clientside specified character string identifying the variable holding the time that each individual ends follow up (is censored or fails)

-
statusCol
+
statusCol

a clientside specified character string identifying the variable holding the final censoring status (failed/censored)

-
vartext
+
vartext

is a clientside provided vector of character strings denoting the -column names of additional variables to include in the +column names of additional variables to include in the final expanded table. If the 'variables' argument is not set (is null) but the 'data' argument is set the full data.frame will be expanded and carried forward

@@ -130,15 +132,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/lexisDS3.html b/docs/reference/lexisDS3.html index 31bb5430..1bb5ff2a 100644 --- a/docs/reference/lexisDS3.html +++ b/docs/reference/lexisDS3.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -67,15 +67,15 @@

Details

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/listDS.html b/docs/reference/listDS.html index e68bc4af..62e8c536 100644 --- a/docs/reference/listDS.html +++ b/docs/reference/listDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,19 +49,19 @@

Coerce objects into a list

Arguments

-
input
+ + +
input

a list of objects to coerce into a list

-
eltnames
+
eltnames

a character list, the names of the elements in the list.

Value

- - -

a list

+

a list

Details

@@ -85,15 +85,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/listDisclosureSettingsDS.html b/docs/reference/listDisclosureSettingsDS.html index f09c16e9..66404883 100644 --- a/docs/reference/listDisclosureSettingsDS.html +++ b/docs/reference/listDisclosureSettingsDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -70,15 +70,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/lmerSLMADS.assign.html b/docs/reference/lmerSLMADS.assign.html index 3fc9c172..62a8777a 100644 --- a/docs/reference/lmerSLMADS.assign.html +++ b/docs/reference/lmerSLMADS.assign.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -61,48 +61,48 @@

Fitting linear mixed effect models - serverside function

Arguments

-
formula
+ + +
formula

see help for ds.lmerSLMA

-
offset
+
offset

see help for ds.lmerSLMA

-
weights
+
weights

see help for ds.lmerSLMA

-
dataName
+
dataName

see help for ds.lmerSLMA

-
REML
+
REML

see help for ds.lmerSLMA

-
control_type
+
control_type

see help for ds.lmerSLMA

-
control_value.transmit
+
control_value.transmit

see help for argument <control_value> for function ds.lmerSLMA

-
optimizer
+
optimizer

see help for ds.lmerSLMA

-
verbose
+
verbose

see help for ds.lmerSLMA

Value

- - -

writes lmerMod object summarising the fitted model to the serverside. +

writes lmerMod object summarising the fitted model to the serverside. For more detailed information see help for ds.lmerSLMA.

@@ -129,15 +129,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/lmerSLMADS2.html b/docs/reference/lmerSLMADS2.html index b7c97e60..37b128c9 100644 --- a/docs/reference/lmerSLMADS2.html +++ b/docs/reference/lmerSLMADS2.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -63,48 +63,48 @@

Fitting linear mixed effect models - serverside function

Arguments

-
formula
+ + +
formula

see help for ds.lmerSLMA

-
offset
+
offset

see help for ds.lmerSLMA

-
weights
+
weights

see help for ds.lmerSLMA

-
dataName
+
dataName

see help for ds.lmerSLMA

-
REML
+
REML

see help for ds.lmerSLMA

-
control_type
+
control_type

see help for ds.lmerSLMA

-
control_value.transmit
+
control_value.transmit

see help for argument <control_value> for function ds.lmerSLMA

-
optimizer
+
optimizer

see help for ds.lmerSLMA

-
verbose
+
verbose

see help for ds.lmerSLMA

Value

- - -

all key model components see help for ds.lmerSLMA

+

all key model components see help for ds.lmerSLMA

Details

@@ -139,15 +139,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/lsDS.html b/docs/reference/lsDS.html index c18d876f..8d578a9e 100644 --- a/docs/reference/lsDS.html +++ b/docs/reference/lsDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,13 +51,15 @@

lists all objects on a serverside environment

Arguments

-
search.filter
+ + +
search.filter

either NULL or a character string (potentially including '*' wildcards) specifying required search criteria. This argument is fully specified by its corresponding argument in the clientside function.

-
env.to.search
+

integer (e.g. in a format such as '2' or '5L' format) specifying the position in the search path of the environment to be explored. This argument is fully specified by its corresponding argument in the clientside function.

@@ -65,9 +67,7 @@

Arguments

Value

- - -

a list containing: (1) the name/details of the serverside R environment +

a list containing: (1) the name/details of the serverside R environment which ds.ls has searched; (2) a vector of character strings giving the names of all objects meeting the naming criteria specified by the argument <search.filter> in this specified R serverside environment; (3) the nature of the search filter string as it was @@ -76,11 +76,11 @@

Value

Details

Serverside aggregate function lsDS called by clientside function -ds.ls. When running analyses one may want to know the objects already generated. This -request is not disclosive as it only returns the names of the objects and not their contents. +ds.ls. When running analyses one may want to know the objects already generated. This +request is not disclosive as it only returns the names of the objects and not their contents. By default, objects in the current 'active analytic environment' (".GlobalEnv") will be displayed. This -is the environment that contains all of the objects that serverside DataSHIELD +is the environment that contains all of the objects that serverside DataSHIELD is using for the main analysis or has written out to the serverside during the process of managing or undertaking the analysis (variables, scalars, matrices, data.frames etc). For further details see help for ds.ls function and for native R function ls

@@ -102,15 +102,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/lsplineDS.html b/docs/reference/lsplineDS.html index fddd4fc5..cb9fd98a 100644 --- a/docs/reference/lsplineDS.html +++ b/docs/reference/lsplineDS.html @@ -6,7 +6,7 @@ - +
@@ -32,13 +32,13 @@
- +
@@ -55,27 +55,27 @@

Basis for a piecewise linear spline with meaningful coefficients

Arguments

-
x
+ + +
x

the name of the input numeric variable

-
knots
+
knots

numeric vector of knot positions

-
marginal
+
marginal

logical, how to parametrize the spline, see Details

-
names,
+
names,

character, vector of names for constructed variables

Value

- - -

an object of class "lspline" and "matrix", which its name is specified by the +

an object of class "lspline" and "matrix", which its name is specified by the newobj argument (or its default name "lspline.newobj"), is assigned on the serverside.

@@ -102,15 +102,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/matrixDS.html b/docs/reference/matrixDS.html index a95c193a..79c56ac9 100644 --- a/docs/reference/matrixDS.html +++ b/docs/reference/matrixDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,34 +49,36 @@

matrixDS assign function called by ds.matrix

Arguments

-
mdata.transmit
+ + +
mdata.transmit

specifies the elements of the matrix to be created. Fully specified by <mdata> argument of ds.matrix

-
from
+
from

a character string specifying the source and nature of <mdata>. Fully specified by <from> argument of ds.matrix

-
nrows.transmit
+
nrows.transmit

specifies the number of rows in the matrix to be created. Fully specified by <nrows.scalar> argument of ds.matrix

-
ncols.transmit
+
ncols.transmit

specifies the number of columns in the matrix to be created. Fully specified by <ncols.scalar> argument of ds.matrix

-
byrow
+
byrow

a logical value specifying whether, when <mdata> is a vector, the matrix created should be filled row by row or column by column. Fully specified by <byrow> argument of ds.matrix

-
dimnames
+
dimnames

A dimnames attribute for the matrix: NULL or a list of length 2 giving the row and column names respectively. An empty list is treated as NULL, and a list of length one as row names only. @@ -85,9 +87,7 @@

Arguments

Value

- - -

Output is the matrix A written +

Output is the matrix A written to the serverside. For more details see help for ds.matrix

@@ -113,15 +113,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/matrixDetDS1.html b/docs/reference/matrixDetDS1.html index 9b2296b6..a7bdcf12 100644 --- a/docs/reference/matrixDetDS1.html +++ b/docs/reference/matrixDetDS1.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,21 +51,21 @@

matrixDetDS aggregate function called by ds.matrixDet.report

Arguments

-
M1.name
+ + +
M1.name

A character string specifying the name of the matrix for which determinant to be calculated

-
logarithm
+
logarithm

logical. Default is FALSE, which returns the determinant itself, TRUE returns the logarithm of the modulus of the determinant.

Value

- - -

Output is the determinant of the matrix identified by argument <M1> +

Output is the determinant of the matrix identified by argument <M1> which is returned to the clientside. For more details see help for ds.matrixDet

@@ -91,15 +91,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/matrixDetDS2.html b/docs/reference/matrixDetDS2.html index d332100f..eb677e23 100644 --- a/docs/reference/matrixDetDS2.html +++ b/docs/reference/matrixDetDS2.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,21 +51,21 @@

matrixDetDS assign function called by ds.matrixDet

Arguments

-
M1.name
+ + +
M1.name

A character string specifying the name of the matrix for which determinant to be calculated

-
logarithm
+
logarithm

logical. Default is FALSE, which returns the determinant itself, TRUE returns the logarithm of the modulus of the determinant.

Value

- - -

Output is the determinant of the matrix identified by argument <M1> +

Output is the determinant of the matrix identified by argument <M1> which is written to the serverside. For more details see help for ds.matrixDet

@@ -91,15 +91,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/matrixDiagDS.html b/docs/reference/matrixDiagDS.html index 7f17453d..d7bc2849 100644 --- a/docs/reference/matrixDiagDS.html +++ b/docs/reference/matrixDiagDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,19 +53,21 @@

matrixDiagDS assign function called by ds.matrixDiag

Arguments

-
x1.transmit
+ + +
x1.transmit

identifies the input matrix or vector. Fully specified by <x1> argument of ds.matrixDiag. For more details see help for ds.matrixDiag.

-
aim
+
aim

a character string specifying what behaviour is required of the function. Fully specified by <aim> argument of ds.matrixDiag. For more details see help for ds.matrixDiag.

-
nrows.transmit
+
nrows.transmit

a scalar value forcing the number of rows and columns in an output matrix.Fully specified by <nrows.scalar> argument of ds.matrixDiag. @@ -74,9 +76,7 @@

Arguments

Value

- - -

Output is the matrix or vector specified by the <newobj> argument +

Output is the matrix or vector specified by the <newobj> argument (or default name diag_<x1>) which is written to the serverside. For more details see help for ds.matrixDiag.

@@ -101,15 +101,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/matrixDimnamesDS.html b/docs/reference/matrixDimnamesDS.html index a26f5417..ded7e0de 100644 --- a/docs/reference/matrixDimnamesDS.html +++ b/docs/reference/matrixDimnamesDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,14 +51,16 @@

matrixDimnamesDS assign function called by ds.matrixDimnames

Arguments

-
M1.name
+ + +
M1.name

Specifies the name of the serverside matrix to which dimnames are to be added. Fully specified by <M1> argument of function ds.matrixDimnames. For more details see help for ds.matrixDimnames.

-
dimnames
+
dimnames

A dimnames attribute for the matrix: NULL or a list of length 2 giving the row and column names respectively. Fully specified by <dimnames> argument of @@ -68,9 +70,7 @@

Arguments

Value

- - -

Output is the serverside matrix specified by the <newobj> argument +

Output is the serverside matrix specified by the <newobj> argument (or default name diag_<x1>) with specified dimnames (row and column names) which is written to the serverside.

@@ -98,15 +98,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/matrixInvertDS.html b/docs/reference/matrixInvertDS.html index fc43a81e..7614cb5c 100644 --- a/docs/reference/matrixInvertDS.html +++ b/docs/reference/matrixInvertDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

matrixInvertDS serverside assign function called by ds.matrixInvert

Arguments

-
M1.name
+ + +
M1.name

A character string specifying the name of the matrix to be inverted

Value

- - -

Output is the matrix representing the inverse of A which is written +

Output is the matrix representing the inverse of A which is written to the serverside. For more details see help for ds.matrixInvert

@@ -83,15 +83,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/matrixMultDS.html b/docs/reference/matrixMultDS.html index a0c95671..9a70c644 100644 --- a/docs/reference/matrixMultDS.html +++ b/docs/reference/matrixMultDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,21 +49,21 @@

matrixMultDS serverside assign function called by ds.matrixMult

Arguments

-
M1.name
+ + +
M1.name

A character string specifying the name of the first matrix (M1) argument specified by the M1 argument in the original call to ds.matrixMult

-
M2.name
+
M2.name

A character string specifying the name of the second matrix (M2) argument specified by the M1 argument in the original call to ds.matrixMult

Value

- - -

Output is the matrix representing the product of M1 and M2 which is written +

Output is the matrix representing the product of M1 and M2 which is written to the serverside. For more details see help for ds.matrixMult

@@ -91,15 +91,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/matrixTransposeDS.html b/docs/reference/matrixTransposeDS.html index 3b02ce07..5ac64eb0 100644 --- a/docs/reference/matrixTransposeDS.html +++ b/docs/reference/matrixTransposeDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

matrixTransposeDS serverside assign function called by ds.matrixTranspose

Arguments

-
M1.name
+ + +
M1.name

A character string specifying the name of the matrix to be transposed

Value

- - -

Output is the matrix representing the transpose of A which is written +

Output is the matrix representing the transpose of A which is written to the serverside. For more details see help for ds.matrixTranspose

@@ -84,15 +84,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/meanDS.html b/docs/reference/meanDS.html index 29e3d039..ec4dd679 100644 --- a/docs/reference/meanDS.html +++ b/docs/reference/meanDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Computes statistical mean of a vectores

Arguments

-
xvect
+ + +
xvect

a vector

Value

- - -

a numeric, the statistical mean

+

a numeric, the statistical mean

Details

@@ -81,15 +81,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/meanSdGpDS.html b/docs/reference/meanSdGpDS.html index f426b6a9..9f1324bf 100644 --- a/docs/reference/meanSdGpDS.html +++ b/docs/reference/meanSdGpDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,12 +49,14 @@

MeanSdGpDS

Arguments

-
X
+ + +
X

a clientside supplied character string identifying the variable for which means/SDs are to be calculated

-
INDEX
+
INDEX

a clientside supplied character string identifying the factor across which means/SDs are to be calculated

@@ -81,15 +83,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/mergeDS.html b/docs/reference/mergeDS.html index 2effc6fe..8beeb231 100644 --- a/docs/reference/mergeDS.html +++ b/docs/reference/mergeDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -62,63 +62,65 @@

mergeDS (assign function) called by ds.merge

Arguments

-
x.name,
+ + +
x.name,

the name of the first data.frame to be merged specified in inverted commas. Specified via argument <x.name> of ds.merge function

-
y.name,
+
y.name,

the name of the second data.frame to be merged specified in inverted commas. Specified via argument <y.name> of ds.merge function

-
by.x.names.transmit
+
by.x.names.transmit

the name of a single variable or a vector of names of multiple variables (in transmittable form) containing the IDs or other data on which data.frame x is to be merged/linked to data.frame y. Specified via argument <by.x.names> of ds.merge function

-
by.y.names.transmit
+
by.y.names.transmit

the name of a single variable or a vector of names of multiple variables (in transmittable form) containing the IDs or other data on which data.frame y is to be merged/linked to data.frame x. Specified via argument <by.y.names> of ds.merge function

-
all.x
+
all.x

logical, if TRUE, then extra rows will be added to the output, one for each row in x that has no matching row in y. Specified via argument <all.x> of ds.merge function. Default = FALSE.

-
all.y
+
all.y

logical, if TRUE, then extra rows will be added to the output, one for each row in y that has no matching row in x. Specified via argument <all.y> of ds.merge function. Default = FALSE.

-
sort
+
sort

logical, if TRUE the merged result should be sorted on elements in the by.x.names and by.y.names columns. Specified via argument <sort> of ds.merge function. Default = TRUE.

-
suffixes.transmit
+
suffixes.transmit

a character vector of length 2 (in transmittable form) specifying the suffixes to be used for making unique common column names in the two input data.frames when they both appear in the merged data.frame. Specified via argument <suffixes> of ds.merge function. Default '.x' and '.y'.

-
no.dups
+
no.dups

logical, when TRUE suffixes are appended in more cases to rigorously avoid duplicated column names in the merged data.frame. Specified via argument <no.dups> of ds.merge function. Default TRUE but was apparently implicitly FALSE before R version 3.5.0.

-
incomparables,
+
incomparables,

values intended for merging on one column which cannot be matched. See 'match' in help for Native R merge function. Specified via argument <incomparables> of @@ -127,9 +129,7 @@

Arguments

Value

- - -

the merged data.frame specified by the <newobj> argument +

the merged data.frame specified by the <newobj> argument of ds.merge (or by default 'x.name_y.name' if the <newobj> argument is NULL) which is written to the serverside. In addition, two validity messages are returned to the clientside @@ -137,10 +137,8 @@

Value

it is in a valid form. If its form is not valid in at least one study there may be a studysideMessage 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 +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 studysideMessage from any datasource in which there was an error in creating <newobj> and a studysideMessage was saved. If there was no error and <newobj> was created without problems no studysideMessage will have been saved and ds.message(<newobj>) @@ -168,15 +166,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/messageDS.html b/docs/reference/messageDS.html index 2280c468..cc57c456 100644 --- a/docs/reference/messageDS.html +++ b/docs/reference/messageDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,16 +51,16 @@

messageDS

Arguments

-
message.object.name
+ + +
message.object.name

is a character string, containing the name of the list containing the message. See the header of the client-side function ds.message for more details.

Value

- - -

a list object from each study, containing whatever message has been written by +

a list object from each study, containing whatever message has been written by DataSHIELD into $studysideMessage.

@@ -98,15 +98,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/metadataDS.html b/docs/reference/metadataDS.html index 86379c5e..03f8e9c4 100644 --- a/docs/reference/metadataDS.html +++ b/docs/reference/metadataDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Returns the metadata, if any, about the specified variable

Arguments

-
x
+ + +
x

a string character, containing the name of the specified variable

Value

- - -

a list containing the metadata. The elements of the list will depend +

a list containing the metadata. The elements of the list will depend on the meatadata available.

@@ -81,15 +81,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/miceDS.html b/docs/reference/miceDS.html index 7b4ab9eb..ef558d2d 100644 --- a/docs/reference/miceDS.html +++ b/docs/reference/miceDS.html @@ -1,7 +1,7 @@ -Aggregate function called by ds.mice — miceDS • dsBaseAggregate function called by ds.mice — miceDS • dsBase - +
@@ -35,20 +35,20 @@
- +
-

This function is a wrapper function of the mice from the mice R +

This function is a wrapper function of the mice from the mice R package. The function creates multiple imputations (replacement values) -for multivariate missing data. The method is based on Fully Conditional Specification, +for multivariate missing data. The method is based on Fully Conditional Specification, where each incomplete variable is imputed by a separate model. The MICE algorithm can impute mixes of continuous, binary, unordered categorical and ordered categorical data. In addition, MICE can impute continuous two-level data, and maintain consistency between @@ -72,72 +72,72 @@

Aggregate function called by ds.mice

Arguments

-
data
+ + +
data

a data frame or a matrix containing the incomplete data.

-
m
-

Number of multiple imputations. The default is m=5. The maximum allowed +

m
+

Number of multiple imputations. The default is m=5. The maximum allowed number in DataSHIELD is m=20.

-
maxit
-

A scalar giving the number of iterations. The default is 5. The maximum +

maxit
+

A scalar giving the number of iterations. The default is 5. The maximum allowed number in DataSHIELD is maxit=30.

-
method
-

Can be either a single string, or a vector of strings with length -ncol(data), specifying the imputation method to be used for each column in data. If -specified as a single string, the same method will be used for all blocks. The default -imputation method (when no argument is specified) depends on the measurement level of -the target column, as regulated by the defaultMethod argument in native R mice function. +

method
+

Can be either a single string, or a vector of strings with length +ncol(data), specifying the imputation method to be used for each column in data. If +specified as a single string, the same method will be used for all blocks. The default +imputation method (when no argument is specified) depends on the measurement level of +the target column, as regulated by the defaultMethod argument in native R mice function. Columns that need not be imputed have the empty method "".

-
post
-

A vector of strings with length ncol(data) specifying expressions as strings. -Each string is parsed and executed within the sampler() function to post-process imputed -values during the iterations. The default is a vector of empty strings, indicating no +

post
+

A vector of strings with length ncol(data) specifying expressions as strings. +Each string is parsed and executed within the sampler() function to post-process imputed +values during the iterations. The default is a vector of empty strings, indicating no post-processing. Multivariate (block) imputation methods ignore the post parameter.

-
seed
+
seed

either NA (default) or "fixed". If seed is set to "fixed" then a fixed seed random number generator which is study-specific is used.

-
predictorMatrix
-

A numeric matrix of ncol(data) rows and ncol(data) columns, +

predictorMatrix
+

A numeric matrix of ncol(data) rows and ncol(data) columns, containing 0/1 data specifying the set of predictors to be used for each target column. -Each row corresponds to a variable to be imputed. A value of 1 means that the column +Each row corresponds to a variable to be imputed. A value of 1 means that the column variable is used as a predictor for the target variables (in the rows). By default, the -predictorMatrix is a square matrix of ncol(data) rows and columns with all 1's, except +predictorMatrix is a square matrix of ncol(data) rows and columns with all 1's, except for the diagonal.

-
ncol.pred.mat
+
ncol.pred.mat

the number of columns of the predictorMatrix.

-
newobj_mids
+
newobj_mids

a character string that provides the name for the output mids object that is stored on the data servers. Default mids_object.

-
newobj_df
-

a character string that provides the name for the output dataframes -that are stored on the data servers. Default imputationSet. For example, if m=5, and +

newobj_df
+

a character string that provides the name for the output dataframes +that are stored on the data servers. Default imputationSet. For example, if m=5, and newobj_df="imputationSet", then five imputed dataframes are saved on the servers with names imputationSet.1, imputationSet.2, imputationSet.3, imputationSet.4, imputationSet.5.

Value

- - -

a list with three elements: the method, the predictorMatrix and the post. -The function also saves in each server the mids object and all completed datasets as +

a list with three elements: the method, the predictorMatrix and the post. +The function also saves in each server the mids object and all completed datasets as dataframes.

@@ -162,15 +162,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/minMaxRandDS.html b/docs/reference/minMaxRandDS.html index 06eb5e62..1f5b54c4 100644 --- a/docs/reference/minMaxRandDS.html +++ b/docs/reference/minMaxRandDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,7 +53,9 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources

Arguments

-
input.var.name
+ + +
input.var.name

a character string specifying the name of V2BR. This argument is set by the argument with the same name in the clientside function ds.ranksSecure

@@ -61,9 +63,7 @@

Arguments

Value

- - -

the data frame objects containing the global ranks and quantiles. +

the data frame objects containing the global ranks and quantiles. For more details see the associated document entitled "secure.global.ranking.docx"

@@ -94,15 +94,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/namesDS.html b/docs/reference/namesDS.html index 3675895a..7da494ad 100644 --- a/docs/reference/namesDS.html +++ b/docs/reference/namesDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Return the names of a list object

Arguments

-
xname.transmit
+ + +
xname.transmit

a character string specifying the name of the list.

Value

- - -

namesDS returns to the client-side the names +

namesDS returns to the client-side the names of a list object stored on the server-side.

@@ -91,15 +91,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/nsDS.html b/docs/reference/nsDS.html index 730beb4c..1521cee6 100644 --- a/docs/reference/nsDS.html +++ b/docs/reference/nsDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,27 +53,29 @@

Generate a Basis Matrix for Natural Cubic Splines

Arguments

-
x
+ + +
x

the predictor variable. Missing values are allowed.

-
df
-

degrees of freedom. One can supply df rather than knots; ns() then chooses +

df
+

degrees of freedom. One can supply df rather than knots; ns() then chooses df - 1 - intercept knots at suitably chosen quantiles of x (which will ignore missing values). The default, df = NULL, sets the number of inner knots as length(knots).

-
knots
+
knots

breakpoints that define the spline. The default is no knots; together with the natural boundary conditions this results in a basis for linear regression on x. Typical values are the mean or median for one knot, quantiles for more knots. See also Boundary.knots.

-
intercept
+
intercept

if TRUE, an intercept is included in the basis; default is FALSE.

-
Boundary.knots
+
Boundary.knots

boundary points at which to impose the natural boundary conditions and anchor the B-spline basis (default the range of the data). If both knots and Boundary.knots are supplied, the basis parameters do not depend on x. Data can extend beyond Boundary.knots

@@ -81,9 +83,7 @@

Arguments

Value

- - -

A matrix of dimension length(x) * df where either df was supplied or if knots were +

A matrix of dimension length(x) * df where either df was supplied or if knots were supplied, df = length(knots) + 1 + intercept. Attributes are returned that correspond to the arguments to ns, and explicitly give the knots, Boundary.knots etc for use by predict.ns(). The object is assigned at each serverside.

@@ -114,15 +114,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/numNaDS.html b/docs/reference/numNaDS.html index b7b6624c..db1b7b24 100644 --- a/docs/reference/numNaDS.html +++ b/docs/reference/numNaDS.html @@ -1,10 +1,10 @@ -Counts the number of missing values — numNaDS • dsBaseCounts the number of missing values — numNaDS • dsBase - +
@@ -30,18 +30,18 @@
- +
-

this function just counts the number of missing entries +

this function just counts the number of missing entries in a vector.

@@ -51,15 +51,15 @@

Counts the number of missing values

Arguments

-
xvect
+ + +
xvect

a vector

Value

- - -

an integer, the number of missing values

+

an integer, the number of missing values

Author

@@ -78,15 +78,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/qlsplineDS.html b/docs/reference/qlsplineDS.html index eebb5961..9b06b1ab 100644 --- a/docs/reference/qlsplineDS.html +++ b/docs/reference/qlsplineDS.html @@ -6,7 +6,7 @@ - +
@@ -32,13 +32,13 @@
- +
@@ -55,33 +55,33 @@

Basis for a piecewise linear spline with meaningful coefficients

Arguments

-
x
+ + +
x

the name of the input numeric variable

-
q
+
q

numeric, a single scalar greater or equal to 2 for a number of equal-frequency intervals along x or a vector of numbers in (0; 1) specifying the quantiles explicitely.

-
na.rm
+
na.rm

logical, whether NA should be removed when calculating quantiles, passed to na.rm of quantile. Default set to TRUE.

-
marginal
+
marginal

logical, how to parametrize the spline, see Details

-
names
+
names

character, vector of names for constructed variables

Value

- - -

an object of class "lspline" and "matrix", which its name is specified by the +

an object of class "lspline" and "matrix", which its name is specified by the newobj argument (or its default name "qlspline.newobj"), is assigned on the serverside.

@@ -91,7 +91,7 @@

Details

the slope of the first segment. The consecutive coefficients correspond to the change in slope as compared to the previous segment. Function qlspline wraps lspline and calculates the knot positions to be at quantiles -of x. If q is a numerical scalar greater or equal to 2, the quantiles are computed at +of x. If q is a numerical scalar greater or equal to 2, the quantiles are computed at seq(0, 1, length.out = q + 1)[-c(1, q+1)], i.e. knots are at q-tiles of the distribution of x. Alternatively, q can be a vector of values in [0; 1] specifying the quantile probabilities directly (the vector is passed to argument probs of quantile).

@@ -113,15 +113,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/quantileMeanDS.html b/docs/reference/quantileMeanDS.html index b47e134a..3ef051d5 100644 --- a/docs/reference/quantileMeanDS.html +++ b/docs/reference/quantileMeanDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,15 +51,15 @@

Generates quantiles and mean information without maximum and minimum

Arguments

-
xvect
+ + +
xvect

a numerical vector

Value

- - -

a numeric vector that represents the sample quantiles

+

a numeric vector that represents the sample quantiles

Author

@@ -78,15 +78,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/rBinomDS.html b/docs/reference/rBinomDS.html index 7ac2ca9c..147e1367 100644 --- a/docs/reference/rBinomDS.html +++ b/docs/reference/rBinomDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,19 +49,21 @@

rBinomDS serverside assign function

Arguments

-
n
+ + +
n

length of the pseudorandom number vector to be generated as specified by the argument <samp.size> in the function ds.rBinom

-
size
+
size

a scalar that must be a positive integer. Value set directly by <size> argument of ds.rBinom - for details see help for ds.rBinom. May be a scalar or a vector allowing the size to vary from observation to observation.

-
prob
+
prob

a numeric scalar in range 0 > prob > 1 which specifies the probability of a positive response. Value set directly by <prob> argument of ds.rBinom - for details see help for ds.rBinom @@ -71,9 +73,7 @@

Arguments

Value

- - -

Writes the pseudorandom number vector with the characteristics specified +

Writes the pseudorandom number vector with the characteristics specified in the function call as a new serverside vector on the data source on which it has been called. Also returns key information to the clientside: the random seed as specified by you in each @@ -106,15 +106,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/rNormDS.html b/docs/reference/rNormDS.html index f3c027b8..949c82ef 100644 --- a/docs/reference/rNormDS.html +++ b/docs/reference/rNormDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,26 +49,28 @@

rNormDS serverside assign function

Arguments

-
n
+ + +
n

length of the pseudorandom number vector to be generated as specified by the argument <samp.size> in the function ds.rNorm

-
mean
+
mean

this specifies the mean of the pseudorandom number vector to be generated as specified by the argument <mean> in the function ds.rNorm. May be a scalar or a vector allowing the mean to vary from observation to observation.

-
sd
+
sd

this specifies the standard deviation of the pseudorandom number vector to be generated as specified by the argument <sd> in the function ds.rNorm May be a scalar or a vector allowing the sd to vary from observation to observation.

-
force.output.to.k.decimal.places
+
force.output.to.k.decimal.places

scalar integer. Forces the output random number vector to have k decimal places. If 0 rounds it coerces decimal random number output to integer, a k in range 1-8 forces output to @@ -79,9 +81,7 @@

Arguments

Value

- - -

Writes the pseudorandom number vector with the characteristics specified +

Writes the pseudorandom number vector with the characteristics specified in the function call as a new serverside vector on the data source on which it has been called. Also returns key information to the clientside: the random seed as specified by you in each @@ -114,15 +114,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/rPoisDS.html b/docs/reference/rPoisDS.html index 234f0b53..a10a601d 100644 --- a/docs/reference/rPoisDS.html +++ b/docs/reference/rPoisDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,12 +49,14 @@

rPoisDS serverside assign function

Arguments

-
n
+ + +
n

length of the pseudorandom number vector to be generated as specified by the argument <samp.size> in the function ds.rPois

-
lambda
+
lambda

a numeric scalar specifying the expected count of the Poisson distribution used to generate the random counts. Specified directly by the lambda argument in ds.rPois. May be a scalar or a vector allowing lambda @@ -63,9 +65,7 @@

Arguments

Value

- - -

Writes the pseudorandom number vector with the characteristics specified +

Writes the pseudorandom number vector with the characteristics specified in the function call as a new serverside vector on the data source on which it has been called. Also returns key information to the clientside: the random seed as specified by you in each @@ -99,15 +99,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/rUnifDS.html b/docs/reference/rUnifDS.html index 2a698980..a463ba7e 100644 --- a/docs/reference/rUnifDS.html +++ b/docs/reference/rUnifDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,26 +49,28 @@

rUnifDS serverside assign function

Arguments

-
n
+ + +
n

length of the pseudorandom number vector to be generated as specified by the argument <samp.size> in the function ds.rUnif

-
min
+
min

a numeric scalar specifying the minimum of the range across which the random numbers will be generated in each source. Specified directly by the min argument in ds.rUnif. May be a scalar or a vector allowing the min to vary from observation to observation.

-
max
+
max

a numeric scalar specifying the maximum of the range across which the random numbers will be generated in each source. Specified directly by the max argument in ds.rUnif. May be a scalar or a vector allowing the min to vary from observation to observation.

-
force.output.to.k.decimal.places
+
force.output.to.k.decimal.places

scalar integer. Forces the output random number vector to have k decimal places. If 0 rounds it coerces decimal random number output to integer, a k in range 1-8 forces output to @@ -79,9 +81,7 @@

Arguments

Value

- - -

Writes the pseudorandom number vector with the characteristics specified +

Writes the pseudorandom number vector with the characteristics specified in the function call as a new serverside vector on the data source on which it has been called. Also returns key information to the clientside: the random seed as specified by you in each @@ -114,15 +114,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/rangeDS.html b/docs/reference/rangeDS.html index dd37ac9f..17bfa725 100644 --- a/docs/reference/rangeDS.html +++ b/docs/reference/rangeDS.html @@ -1,10 +1,10 @@ -returns the minimum and maximum of a numeric vector — rangeDS • dsBasereturns the minimum and maximum of a numeric vector — rangeDS • dsBase - +
@@ -30,18 +30,18 @@
- +
-

this function is similar to R function range but instead to not return +

this function is similar to R function range but instead to not return the real minimum and maximum, the computed values are multiplied by a very small random number.

@@ -51,15 +51,15 @@

returns the minimum and maximum of a numeric vector

Arguments

-
xvect
+ + +
xvect

a numerical

Value

- - -

a numeric vector which contains the minimum and the maximum values of the vector

+

a numeric vector which contains the minimum and the maximum values of the vector

Author

@@ -78,15 +78,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/ranksSecureDS1.html b/docs/reference/ranksSecureDS1.html index ad11d23b..d3b70045 100644 --- a/docs/reference/ranksSecureDS1.html +++ b/docs/reference/ranksSecureDS1.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,9 +51,7 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources

Value

- - -

the non-disclosive elements of blackbox.output.df (see details) +

the non-disclosive elements of blackbox.output.df (see details) on the serverside as a data frame object (called blackbox.output) on the clientside. After processing to create the global ranks across all studies, this is returned to the serverside as the data frame sR4.df using @@ -90,15 +88,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/ranksSecureDS2.html b/docs/reference/ranksSecureDS2.html index df9eacbb..22e0d665 100644 --- a/docs/reference/ranksSecureDS2.html +++ b/docs/reference/ranksSecureDS2.html @@ -10,7 +10,7 @@ - +
@@ -36,13 +36,13 @@
- +
@@ -63,16 +63,14 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources

Value

- - -

creates a new data frame sR5.df on the serverside containing +

creates a new data frame sR5.df on the serverside containing solely the real data and including key elements needed for next stage of the ranking process. Most crucially these include "global.rank" and "ID.by.val" sorted in ascending order of the magnitude of V2BR

Details

-

Severside assign function called by ds.ranksSecure. +

Severside assign function called by ds.ranksSecure. It works on the on the output created by serverside function ranksSecureDS1 and saved on the serverside in data frame sR4.df by ds.dmtC2S. Having checked QA it strips out all rows corresponding to pseudo-data. The resultant @@ -105,15 +103,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/ranksSecureDS3.html b/docs/reference/ranksSecureDS3.html index 9c86885d..ade8f0d6 100644 --- a/docs/reference/ranksSecureDS3.html +++ b/docs/reference/ranksSecureDS3.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,9 +53,7 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources

Value

- - -

the non-disclosive elements of blackbox.output.df (see details) +

the non-disclosive elements of blackbox.output.df (see details) on the serverside as a data frame object (called sR6.df) on the clientside. After processing within ds.ranksSecure to create the global ranks and global quantiles (of real data only) across all studies, @@ -63,10 +61,8 @@

Value

using the clientside function ds.dmtC2S. To illustrate the difference between ranks and quantiles, if there are a total of 1000 original real observations across all studies and one particular observation has the rank 250, it will -have quantile value 0.25 (i.e. 25

- - -

increasing value). Both ranks and quantiles can have ties. For more details +have quantile value 0.25 (i.e. 25 +increasing value). Both ranks and quantiles can have ties. For more details about the cluster of functions that collectively enable secure global ranking and estimation of global quantiles see the associated document entitled "secure.global.ranking.docx". Also see the header file for ds.ranksSecure

@@ -104,15 +100,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/ranksSecureDS4.html b/docs/reference/ranksSecureDS4.html index 35cd1e20..2ec3a7b1 100644 --- a/docs/reference/ranksSecureDS4.html +++ b/docs/reference/ranksSecureDS4.html @@ -6,7 +6,7 @@ - +
@@ -32,13 +32,13 @@
- +
@@ -55,7 +55,9 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources

Arguments

-
ranks.sort.by
+ + +
ranks.sort.by

a character string taking two possible values. These are "ID.orig" and "vals.orig". These define the order in which the output.ranks.df and summary.output.ranks.df data frames are presented. This @@ -65,9 +67,7 @@

Arguments

Value

- - -

Creates the data frame identified by the name given by the argument +

Creates the data frame identified by the name given by the argument (<output.ranks.df>) of the ds.ranksSecure function and writes it to the serverside. If the argument <output.ranks.df> is NULL or unspecified the output data frame is called "main.ranks.df". The data frame is ordered @@ -115,15 +115,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/ranksSecureDS5.html b/docs/reference/ranksSecureDS5.html index ed117702..ef86ed91 100644 --- a/docs/reference/ranksSecureDS5.html +++ b/docs/reference/ranksSecureDS5.html @@ -6,7 +6,7 @@ - +
@@ -32,13 +32,13 @@
- +
@@ -55,7 +55,9 @@

Secure ranking of "V2BR" (vector to be ranked) across all sources

Arguments

-
output.ranks.df
+ + +
output.ranks.df

a character string which specifies an optional name for the data.frame written to the serverside on each data source that contains 11 of the key output variables from the ranking procedure pertaining @@ -65,9 +67,7 @@

Arguments

Value

- - -

extracts 5 key vectors from the larger data frame created by +

extracts 5 key vectors from the larger data frame created by ranksSecureDS4 to produce a summary data frame that is written to the serverside. It is given a name specified by the argument.

@@ -115,15 +115,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/rbindDS.html b/docs/reference/rbindDS.html index 11815a67..129c0bc9 100644 --- a/docs/reference/rbindDS.html +++ b/docs/reference/rbindDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,7 +53,9 @@

rbindDS called by ds.rbind

Arguments

-
x.names.transmit
+ + +
x.names.transmit

This is a vector of character strings representing the names of the elemental components to be combined converted into a transmittable @@ -61,7 +63,7 @@

Arguments

of ds.rbind

-
colnames.transmit
+
colnames.transmit

This is NULL or a vector of character strings representing forced column names for the output object converted into a transmittable format. This argument is fully @@ -71,9 +73,7 @@

Arguments

Value

- - -

the object specified by the <newobj> argument +

the object specified by the <newobj> argument of ds.rbind(or default name <rbind.out>) which is written to the serverside. As well as writing the output object as <newobj> on the serverside, two validity messages are returned @@ -82,10 +82,8 @@

Value

a disclosure trap was tripped and creation of the full output object was blocked - ds.cbind() 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 +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 studysideMessage from any datasource in which there was an error in creating <newobj> and a studysideMessage was saved. If there was no error and <newobj> was created without problems no studysideMessage will have been saved and ds.message("<newobj>") @@ -115,15 +113,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/reShapeDS.html b/docs/reference/reShapeDS.html index ca6d8146..494828e3 100644 --- a/docs/reference/reShapeDS.html +++ b/docs/reference/reShapeDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -60,19 +60,21 @@

reShapeDS (assign function) called by ds.reShape

Arguments

-
data.name,
+ + +
data.name,

the name of the data.frame to be reshaped. Specified via argument <data.name> of ds.reShape function

-
varying.transmit,
+
varying.transmit,

names of sets of variables in the wide format that correspond to single variables in long format (typically what may be called 'time-varying' or 'time-dependent' variables). Specified via argument <varying> of ds.reShape function.

-
v.names.transmit,
+
v.names.transmit,

the names of variables in the long format that correspond to multiple variables in the wide format - for example, sbp7, sbp11, sbp15 (measured systolic blood pressure @@ -80,31 +82,31 @@

Arguments

via argument <v.names> of ds.reShape function

-
timevar.name,
+
timevar.name,

the variable in long format that differentiates multiple records from the same group or individual. Specified via argument <timevar.name> of ds.reShape function

-
idvar.name,
+
idvar.name,

names of one or more variables in long format that identify multiple records from the same group/individual. This/these variable(s) may also be present in wide format. Specified via argument <idvar.name> of ds.reShape function

-
drop.transmit,
+
drop.transmit,

a vector of names of variables to drop before reshaping. Specified via argument <drop> of ds.reShape function

-
direction,
+
direction,

a character string, partially matched to either "wide" to reshape from long to wide format, or "long" to reshape from wide to long format. Specified via argument <direction> of ds.reShape function

-
sep,
+
sep,

a character vector of length 1, indicating a separating character in the variable names in the wide format. Specified via argument <sep> of ds.reShape function

@@ -112,9 +114,7 @@

Arguments

Value

- - -

a reshaped data.frame converted from long to wide format or from wide to +

a reshaped data.frame converted from long to wide format or from wide to long format which is written to the serverside and given the name provided as the <newobj> argument of ds.reShape or 'newObject' if no name is specified. In addition, two validity messages are returned to the clientside @@ -146,15 +146,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/recodeLevelsDS.html b/docs/reference/recodeLevelsDS.html index 64c1c856..c8ff1438 100644 --- a/docs/reference/recodeLevelsDS.html +++ b/docs/reference/recodeLevelsDS.html @@ -1,10 +1,10 @@ -Recodes the levels of a categorical variables — recodeLevelsDS • dsBaseRecodes the levels of a categorical variables — recodeLevelsDS • dsBase - +
@@ -30,18 +30,18 @@
- +
-

The functions uses the input factor and generates a new factor +

The functions uses the input factor and generates a new factor with new levels.

@@ -51,19 +51,19 @@

Recodes the levels of a categorical variables

Arguments

-
x
+ + +
x

a factor vector

-
classes
+
classes

a character vector the levels of the newt factor vector

Value

- - -

a factor vector with the new levels

+

a factor vector with the new levels

Author

@@ -82,15 +82,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/recodeValuesDS.html b/docs/reference/recodeValuesDS.html index 3366071b..0c9ee4dc 100644 --- a/docs/reference/recodeValuesDS.html +++ b/docs/reference/recodeValuesDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -56,13 +56,15 @@

recodeValuesDS an assign function called by ds.recodeValues

Arguments

-
var.name.text
+ + +
var.name.text

a character string providing the name for the vector representing the variable to be recoded. <var.name.text> argument generated and passed directly to recodeValuesDS by ds.recodeValues

-
values2replace.text
+
values2replace.text

a character string specifying the values in the vector specified by the argument <var.name.text> that are to be replaced by new values as specified in the new.values.vector. The <values2replace.text> argument @@ -72,7 +74,7 @@

Arguments

and so can be accepted by recodeValuesDS

-
new.values.text
+
new.values.text

a character string specifying the new values to which the specified values in the vector <var.name> are to be converted. The <new.values.text> argument is generated and passed directly to recodeValuesDS @@ -82,16 +84,14 @@

Arguments

and so can be used in the call to recodeValuesDS.

-
missing
-

if supplied, any missing values in the variable referred to by var.name.text +

missing
+

if supplied, any missing values in the variable referred to by var.name.text will be replaced by this value.

Value

- - -

the object specified by the <newobj> argument (or default name '<var.name>_recoded') +

the object specified by the <newobj> argument (or default name '<var.name>_recoded') initially specified in calling ds.recodeValues. The output object (the required recoded variable called <newobj> is written to the serverside.

@@ -116,15 +116,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/repDS.html b/docs/reference/repDS.html index 578456d3..d69a5506 100644 --- a/docs/reference/repDS.html +++ b/docs/reference/repDS.html @@ -7,7 +7,7 @@ - +
@@ -33,13 +33,13 @@
- +
@@ -67,14 +67,16 @@

repDS called by ds.rep

Arguments

-
x1.transmit
+ + +
x1.transmit

This argument determines the input scalar, vector or list. for behaviour see help for ds.rep and "details from native R help for <rep>" (see above). This parameter is usually fully defined by the argument <x1> in the call to ds.rep that itself calls repDS.

-
times.transmit
+
times.transmit

This argument determines the number of replications and the pattern of these replications of the input scalar/vector to construct the output repetitive sequence. @@ -83,7 +85,7 @@

Arguments

the argument <times> in the call to ds.rep that itself calls repDS.

-
length.out.transmit
+
length.out.transmit

This argument fixes the length of the output repetive sequence vector For behaviour see help for ds.rep and "details from native R @@ -91,7 +93,7 @@

Arguments

the argument <length.out> in the call to ds.rep that itself calls repDS.

-
each.transmit
+
each.transmit

This argument specifies the number of replications of individual elements rather than replications of the full sequence. For behaviour see help for ds.rep and "details from native R @@ -99,7 +101,7 @@

Arguments

the argument <each> in the call to ds.rep that itself calls repDS.

-
x1.includes.characters
+
x1.includes.characters

Boolean parameter determining whether to coerce the final output sequence to numeric. Defaults to FALSE and output is coerced to numeric. @@ -109,7 +111,7 @@

Arguments

itself calls repDS.

-
source.x1
+
source.x1

This defines the source of the scalar or vector defined by the <x1> argument. Four character strings are allowed: "clientside" or "c" and serverside or "s". @@ -118,19 +120,19 @@

Arguments

the argument <source.x1> in the call to ds.rep that itself calls repDS.

-
source.times
+
source.times

see "param source.x1" This parameter is usually fully defined by the argument <source.times> in the call to ds.rep that itself calls repDS.

-
source.length.out
+
source.length.out

see "param source.x1" This parameter is usually fully defined by the argument <source.length.out> in the call to ds.rep that itself calls repDS.

-
source.each
+
source.each

see "param source.x1" This parameter is usually fully defined by the argument <source.each> in the call to ds.rep that itself calls repDS.

@@ -138,21 +140,17 @@

Arguments

Value

- - -

the vector containing the specified repetitive sequence +

the vector containing the specified repetitive sequence and write to the output object defined by the <newobj> argument -(or default name seq.vect) which is written to the serverside in +(or default name seq.vect) which is written to the serverside in each source. In addition, two validity messages are returned 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.matrixDiag 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 +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 studysideMessage from any datasource in which there was an error in creating <newobj> and a studysideMessage was saved. If there was no error and <newobj> was created without problems no studysideMessage will have been saved and ds.message("newobj") @@ -165,7 +163,7 @@

Details

the function rep in native R also apply (as explained in more detail with exceptions identified in help for ds.rep):

In addition a Details from R help for <rep>:

-

The default behaviour is as if the call was +

The default behaviour is as if the call was rep(x, times = 1, length.out = NA, each = 1) Normally just one of the additional arguments is specified, but if 'each' is specified with either of the other two, its replication is performed first, and @@ -198,15 +196,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/replaceNaDS.html b/docs/reference/replaceNaDS.html index 5291fdc1..223de7f6 100644 --- a/docs/reference/replaceNaDS.html +++ b/docs/reference/replaceNaDS.html @@ -1,10 +1,10 @@ -Replaces the missing values in a vector — replaceNaDS • dsBaseReplaces the missing values in a vector — replaceNaDS • dsBase - +
@@ -30,18 +30,18 @@
- +
-

This function identifies missing values and replaces them by a value or +

This function identifies missing values and replaces them by a value or values specified by the analyst.

@@ -51,27 +51,27 @@

Replaces the missing values in a vector

Arguments

-
xvect
+ + +
xvect

a character, the name of the vector to process.

-
replacements
-

a vector which contains the replacement value(s), a vector one or +

replacements
+

a vector which contains the replacement value(s), a vector one or more values for each study.

Value

- - -

a new vector without missing values

+

a new vector without missing values

Details

-

This function is used when the analyst prefer or requires complete vectors. +

This function is used when the analyst prefer or requires complete vectors. It is then possible the specify one value for each missing value by first returning the number of missing values using the function numNaDS but in most cases -it might be more sensible to replace all missing values by one specific value e.g. +it might be more sensible to replace all missing values by one specific value e.g. replace all missing values in a vector by the mean or median value. Once the missing values have been replaced a new vector is created.

@@ -92,15 +92,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/rmDS.html b/docs/reference/rmDS.html index 4a2038e7..1d30ff89 100644 --- a/docs/reference/rmDS.html +++ b/docs/reference/rmDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,7 +49,9 @@

rmDS an aggregate function called by ds.rm

Arguments

-
x.names.transmit,
+ + +
x.names.transmit,

the names of the objects to be deleted converted into transmissable form, a comma seperated list of character string. The argument is specified via the <x.names> argument of ds.rm

@@ -57,9 +59,7 @@

Arguments

Value

- - -

the specified object is deleted from the serverside. If this +

the specified object is deleted from the serverside. If this is successful the message "Object <x.names> successfully deleted" is returned to the clientside (where x.names are the names of the object to be deleted). If the objects to be deleted is already absent on a given @@ -94,15 +94,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/rowColCalcDS.html b/docs/reference/rowColCalcDS.html index 3c39ead8..01431df2 100644 --- a/docs/reference/rowColCalcDS.html +++ b/docs/reference/rowColCalcDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,24 +51,24 @@

Computes sums and means of rows or columns of numeric arrays

Arguments

-
dataset
+ + +
dataset

an array of two or more dimensions.

-
operation
+
operation

an integer that indicates the operation to carry out: 1 for 'rowSums', 2 for 'colSums', 3 for 'rowMeans' or 4 for 'colMeans'

Value

- - -

a numeric vector

+

a numeric vector

Details

-

the output is returned to the user only the number of entries in the +

the output is returned to the user only the number of entries in the output vector is greater or equal to the allowed size.

@@ -88,15 +88,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/sampleDS.html b/docs/reference/sampleDS.html index 4a7f8413..fef68bea 100644 --- a/docs/reference/sampleDS.html +++ b/docs/reference/sampleDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -58,51 +58,51 @@

random sampling and permuting of vectors, dataframes and matrices

Arguments

-
x.transmit
+ + +
x.transmit

Either a character string providing the name for the serverside vector, matrix or data.frame to be sampled or permuted, or an integer/numeric scalar (e.g. 923) indicating that one should create a new vector on the serverside that is a randomly permuted sample of the vector 1:923. x.transmit is -fully specified by the [x] argument of ds.sample. For further details see +fully specified by the [x] argument of ds.sample. For further details see help for ds.sample and native R help for sample().

-
size.transmit
+
size.transmit

a numeric/integer scalar indicating the size of the sample to be drawn. size.transmit is fully specified by the [size] argument of ds.sample. For further details see help for ds.sample and native R help for sample().

-
replace.transmit
+
replace.transmit

a Boolean indicator (TRUE or FALSE) specifying whether the sample should be drawn with or without replacement. Default is FALSE so the sample is drawn without replacement. replace.transmit is -fully specified by the [replace] argument of ds.sample. For further details see +fully specified by the [replace] argument of ds.sample. For further details see help for ds.sample and native R help for sample().

-
prob.transmit
+
prob.transmit

a character string containing the name of a numeric vector of probability weights on the serverside that is associated with each of the elements of the vector to be sampled enabling the drawing of a sample with some elements given higher probability of being drawn than others. -prob.transmit is fully specified by the [prob] argument of ds.sample. For further details see +prob.transmit is fully specified by the [prob] argument of ds.sample. For further details see help for ds.sample and native R help for sample().

Value

- - -

the object specified by the <newobj> argument (or default name -'newobj.sample') which is written to the serverside. For further details see +

the object specified by the <newobj> argument (or default name +'newobj.sample') which is written to the serverside. For further details see help for ds.sample and native R help for sample().

Details

Serverside assign function sampleDS called by clientside function ds.sample. Based on the native R function sample() but deals -slightly differently with data.frames and matrices. For further details see +slightly differently with data.frames and matrices. For further details see help for ds.sample and native R help for sample().

@@ -122,15 +122,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/scatterPlotDS.html b/docs/reference/scatterPlotDS.html index 0bf94795..1f9c6316 100644 --- a/docs/reference/scatterPlotDS.html +++ b/docs/reference/scatterPlotDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,35 +51,35 @@

Calculates the coordinates of the data to be plot

Arguments

-
x
+ + +
x

the name of a numeric vector, the x-variable.

-
y
+
y

the name of a numeric vector, the y-variable.

-
method.indicator
+
method.indicator

an integer either 1 or 2. If the user selects the deterministic method in the client side function the method.indicator is set to 1 while if the user selects the probabilistic method this argument is set to 2.

-
k
+
k

the number of the nearest neghbours for which their centroid is calculated if the deterministic method is selected.

-
noise
+
noise

the percentage of the initial variance that is used as the variance of the embedded noise if the probabilistic method is selected.

Value

- - -

a list with the x and y coordinates of the data to be plot

+

a list with the x and y coordinates of the data to be plot

Details

@@ -113,15 +113,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/seqDS.html b/docs/reference/seqDS.html index c908170d..05fc8cf6 100644 --- a/docs/reference/seqDS.html +++ b/docs/reference/seqDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -55,37 +55,39 @@

seqDS a serverside assign function called by ds.seq

Arguments

-
FROM.value.char
+ + +
FROM.value.char

the starting value for the sequence expressed as an integer -or real number with a decimal point but +or real number with a decimal point but in character form. Fully specified by <FROM.value.char> argument of ds.seq.

-
TO.value.char
+
TO.value.char

the terminal value for the sequence expressed as an integer -or real number with a decimal point but +or real number with a decimal point but in character form. Fully specified by <TO.value.char> argument of ds.seq.

-
BY.value.char
+
BY.value.char

the value to increment each step in the sequence expressed as an integer -or real number with a decimal point but +or real number with a decimal point but in character form. Fully specified by <BY.value.char> argument of ds.seq.

-
LENGTH.OUT.value.char
+
LENGTH.OUT.value.char

length of the sequence at which point its extension should be stopped, expressed as an integer -or real number with a decimal point but +or real number with a decimal point but in character form. Fully specified by <LENGTH.OUT.value.char> argument of ds.seq.

-
ALONG.WITH.name
+
ALONG.WITH.name

For convenience, rather than specifying a value for LENGTH.OUT it can often be better to specify a variable name as the <ALONG.WITH.name> argument. Fully specified by <ALONG.WITH.name> argument @@ -94,11 +96,9 @@

Arguments

Value

- - -

the object specified by the <newobj> argument of +

the object specified by the <newobj> argument of ds.seq (or its default name newObj) -which is written to the serverside. +which is written to the serverside. As well as writing the output object as <newobj> on the serverside, two validity messages are returned indicating whether <newobj> has been created in each data source and if so whether @@ -106,10 +106,8 @@

Value

a disclosure trap was tripped and creation of the full output object was blocked - ds.seq() 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 +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 studysideMessage from any datasource in which there was an error in creating <newobj> and a studysideMessage was saved. If there was no error and <newobj> was created without problems no studysideMessage will have been saved and ds.message("<newobj>") @@ -141,15 +139,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/setFilterDS.html b/docs/reference/setFilterDS.html index 6ed94abf..305b2f6a 100644 --- a/docs/reference/setFilterDS.html +++ b/docs/reference/setFilterDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,15 +53,15 @@

Sets the privacy level

Arguments

-
x
+ + +
x

a dummy argument

Value

- - -

an integer between 1 and 5

+

an integer between 1 and 5

Details

@@ -84,15 +84,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/setSeedDS.html b/docs/reference/setSeedDS.html index 81f98aa9..ed096786 100644 --- a/docs/reference/setSeedDS.html +++ b/docs/reference/setSeedDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,7 +51,9 @@

setSeedDs called by ds.setSeed, ds.rNorm, ds.rUnif, ds.rPois and ds.rBinom

Arguments

-
seedtext
+ + +
seedtext

this is simply the value of the <seed.as.integer> argument of ds.setSeed, ds.rNorm, ds.rUnif, ds.rPois of ds.rBinom coerced into character format. This is done by the clientside functions themselves @@ -60,19 +62,17 @@

Arguments

for the argument <seed.as.integer> for more details.

-
kind
+
kind

see help for set.seed() function in native R

-
normal.kind
+
normal.kind

see help for set.seed() function in native R

Value

- - -

Sets the values of the vector of integers of length 626 known as +

Sets the values of the vector of integers of length 626 known as .Random.seed on each data source that is the true current state of the random seed in each source.

@@ -114,15 +114,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/skewnessDS1.html b/docs/reference/skewnessDS1.html index 953110f9..5e42b266 100644 --- a/docs/reference/skewnessDS1.html +++ b/docs/reference/skewnessDS1.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,25 +49,25 @@

Calculates the skewness of a numeric variable

Arguments

-
x
+ + +
x

a string character, the name of a numeric variable.

-
method
+
method

an integer between 1 and 3 selecting one of the algorithms for computing skewness detailed in the headers of the client-side ds.skewness function.

Value

- - -

a list including the skewness of the input numeric variable, the number of valid observations and +

a list including the skewness of the input numeric variable, the number of valid observations and the study-side validity message.

Details

-

The function calculates the skewness of an input variable x with three different methods. +

The function calculates the skewness of an input variable x with three different methods. The method is specified by the argument method in the client-side ds.skewness function.

@@ -87,15 +87,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/skewnessDS2.html b/docs/reference/skewnessDS2.html index f02589ca..7e6cc5ff 100644 --- a/docs/reference/skewnessDS2.html +++ b/docs/reference/skewnessDS2.html @@ -1,10 +1,10 @@ -Calculates the skewness of a numeric variable — skewnessDS2 • dsBaseCalculates the skewness of a numeric variable — skewnessDS2 • dsBase - +
@@ -30,18 +30,18 @@
- +
-

This function calculates summary statistics that are returned to the client-side and +

This function calculates summary statistics that are returned to the client-side and used for the estimation of the combined skewness of a numeric variable across all studies.

@@ -51,22 +51,22 @@

Calculates the skewness of a numeric variable

Arguments

-
x
+ + +
x

a string character, the name of a numeric variable.

-
global.mean
+
global.mean

a numeric, the combined mean of the input variable across all studies.

Value

- - -

a list including the sum of cubed differences between the values of x and the global mean of x across +

a list including the sum of cubed differences between the values of x and the global mean of x across all studies, the sum of squared differences between the values of x and the global mean of x across all studies, -the number of valid observations (i.e. the length of x after excluding missing values), and a validity message -indicating indicating a valid analysis if the number of valid observations are above the protection filter +the number of valid observations (i.e. the length of x after excluding missing values), and a validity message +indicating indicating a valid analysis if the number of valid observations are above the protection filter nfilter.tab or invalid analysis otherwise.

@@ -92,15 +92,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/sqrtDS.html b/docs/reference/sqrtDS.html index 00d291b6..182fe031 100644 --- a/docs/reference/sqrtDS.html +++ b/docs/reference/sqrtDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,17 +49,17 @@

Computes the square root values of the input variable

Arguments

-
x
+ + +
x

a string character, the name of a numeric or integer vector

Value

- - -

the object specified by the newobj argument +

the object specified by the newobj argument of ds.sqrt (or default name sqrt.newobj) -which is written to the server-side. The output object is of class numeric +which is written to the server-side. The output object is of class numeric or integer.

@@ -84,15 +84,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/subsetByClassDS.html b/docs/reference/subsetByClassDS.html index cd13b604..7afe3c3e 100644 --- a/docs/reference/subsetByClassDS.html +++ b/docs/reference/subsetByClassDS.html @@ -1,11 +1,11 @@ Breaks down a dataframe or a factor into its sub-classes — subsetByClassDS • dsBase - +
@@ -31,19 +31,19 @@
- +

The function takes a categorical vector or dataframe as input and generates subset(s) -vectors or dataframes for each category. Subsets are considered invalid if they hold between 1 and +vectors or dataframes for each category. Subsets are considered invalid if they hold between 1 and 4 observations.

@@ -53,25 +53,25 @@

Breaks down a dataframe or a factor into its sub-classes

Arguments

-
data
+ + +
data

a string character, the name of the dataframe or the factor vector

-
variables
+
variables

a vector of string characters, the names of the the variables to subset on.

Value

- - -

a list which contains the subsetted datasets

+

a list which contains the subsetted datasets

Details

-

If the input data object is a dataframe it is possible to specify the variables +

If the input data object is a dataframe it is possible to specify the variables to subset on. If a subset is not 'valid' all its the values are reported as missing (i.e. NA), -the name of the subsets is labelled as '_INVALID'. If no variables are specified to subset on, +the name of the subsets is labelled as '_INVALID'. If no variables are specified to subset on, the dataframe will be subset on each of its factor variables. And if none of the columns holds a factor variable a message is issued as output. A message is also issued as output if the input vector is not of type factor.

@@ -93,15 +93,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/subsetByClassHelper1.html b/docs/reference/subsetByClassHelper1.html index 6b5e003e..68d07ac2 100644 --- a/docs/reference/subsetByClassHelper1.html +++ b/docs/reference/subsetByClassHelper1.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,23 +49,23 @@

generates subsets vectors from a factor vector

Arguments

-
xvect
+ + +
xvect

a vector of type factor.

-
xname
+
xname

the name of the vector.

-
filter
+
filter

the minimum number observation (i.e. rows) that are allowed.

Value

- - -

a list which contains the subsets.

+

a list which contains the subsets.

Details

@@ -88,15 +88,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/subsetByClassHelper2.html b/docs/reference/subsetByClassHelper2.html index bc38c980..dd117e0b 100644 --- a/docs/reference/subsetByClassHelper2.html +++ b/docs/reference/subsetByClassHelper2.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,29 +49,29 @@

generates subset tables from a data frame

Arguments

-
df
+ + +
df

a data frame.

-
iter
+
iter

the indices of columns to loop trough.

-
filter
+
filter

the minimum number of observations (i.e. rows) that are allowed.

Value

- - -

a list which contains the subsets, their names and an integer that indicates how many columns were +

a list which contains the subsets, their names and an integer that indicates how many columns were not factors.

Details

-

The function generates subsets if the input of 'subsetByClassDS' is a data frame -and if the number variables(columns) to subset by are greater than 1; i.e. this +

The function generates subsets if the input of 'subsetByClassDS' is a data frame +and if the number variables(columns) to subset by are greater than 1; i.e. this function is called if the user specified more than one variable or no variable to subset by (if no variables are specified the function 'subsetByClassDS' produces a subset for each category in each variable).

@@ -93,15 +93,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/subsetByClassHelper3.html b/docs/reference/subsetByClassHelper3.html index e98d653b..c52b6644 100644 --- a/docs/reference/subsetByClassHelper3.html +++ b/docs/reference/subsetByClassHelper3.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,29 +49,29 @@

generates subset tables from a data frame

Arguments

-
df
+ + +
df

a data frame.

-
indx1
+
indx1

the column index of the variable specified by the user.

-
filter
+
filter

the minimum number of observations (i.e. rows) that are allowed.

Value

- - -

a list which contains the subsets, their names and an integer that indicates if +

a list which contains the subsets, their names and an integer that indicates if the variable specified by user is a factor.

Details

-

The function generates subsets if the input of 'subsetByClassDS' is a data frame -and if the number of variables (columns) to subset by is 1; i.e. this +

The function generates subsets if the input of 'subsetByClassDS' is a data frame +and if the number of variables (columns) to subset by is 1; i.e. this function is called if the user specified one variable to subset by.

@@ -91,15 +91,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/subsetDS.html b/docs/reference/subsetDS.html index d3b5ba36..c9809667 100644 --- a/docs/reference/subsetDS.html +++ b/docs/reference/subsetDS.html @@ -1,11 +1,11 @@ -Generates a valid subset of a table or a vector — subsetDS • dsBaseGenerates a valid subset of a table or a vector — subsetDS • dsBase - +
@@ -31,19 +31,19 @@
- +
-

The function uses the R classical subsetting with squared brackets '[]' and allows also to -subset using a logical oprator and a threshold. The object to subset from must be a vector (factor, numeric +

The function uses the R classical subsetting with squared brackets '[]' and allows also to +subset using a logical oprator and a threshold. The object to subset from must be a vector (factor, numeric or charcater) or a table (data.frame or matrix).

@@ -61,34 +61,36 @@

Generates a valid subset of a table or a vector

Arguments

-
dt
+ + +
dt

a string character, the name of the dataframe or the factor vector and the range of the subset.

-
complt
+
complt

a boolean that tells if the subset to subset should include only complete cases

-
rs
+
rs

a vector of two integers that give the range of rows de extract.

-
cs
-

a vector of two integers or one or more characters; the indices of the columns to extract or the names of the columns (i.e. +

cs
+

a vector of two integers or one or more characters; the indices of the columns to extract or the names of the columns (i.e. names of the variables to extract).

-
lg
-

a character, the logical parameter to use if the user wishes to subset a vector using a logical +

lg
+

a character, the logical parameter to use if the user wishes to subset a vector using a logical operator. This parameter is ignored if the input data is not a vector.

-
th
-

a numeric, the threshold to use in conjunction with the logical parameter. This parameter is ignored +

th
+

a numeric, the threshold to use in conjunction with the logical parameter. This parameter is ignored if the input data is not a vector.

-
varname
+
varname

a character, if the input data is a table, if this parameter is provided along with the 'logical' and 'threshold' parameters, a subtable is based the threshold applied to the speicified variable. This parameter is however ignored if the parameter 'rows' and/or 'cols' are provided.

@@ -96,15 +98,13 @@

Arguments

Value

- - -

a subset of the vector, matric or dataframe as specified is stored on the server side

+

a subset of the vector, matric or dataframe as specified is stored on the server side

Details

-

If the input data is a table: The user specifies the rows and/or columns to include in the subset if the input -object is a table; the columns can be refered to by their names. The name of a vector (i.e. a variable) can also be provided -with a logical operator and a threshold (see example 3). +

If the input data is a table: The user specifies the rows and/or columns to include in the subset if the input +object is a table; the columns can be refered to by their names. The name of a vector (i.e. a variable) can also be provided +with a logical operator and a threshold (see example 3). If the input data is a vector: when the parameters 'rows', 'logical' and 'threshold' are all provided the last two are ignored ( 'rows' has precedence over the other two parameters then). If the requested subset is not valid (i.e. contains less than the allowed @@ -128,15 +128,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/table1DDS.html b/docs/reference/table1DDS.html index efb1ecf2..e061bc3e 100644 --- a/docs/reference/table1DDS.html +++ b/docs/reference/table1DDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,23 +51,23 @@

Creates 1-dimensional contingency tables

Arguments

-
xvect
+ + +
xvect

a numerical vector with discrete values - usually a factor.

Value

- - -

a list which contains two elements: 'table', the 1-dimensional table and 'message' a message which +

a list which contains two elements: 'table', the 1-dimensional table and 'message' a message which informs about the validity of the table.

Details

-

It generates a 1-dimensional tables where valid (non-disclosive) 1-dimensional tables are defined +

It generates a 1-dimensional tables where valid (non-disclosive) 1-dimensional tables are defined as data from sources where no table cells have counts between 1 and the set threshold. When the ouput table -is invalid all cells but the total count are replaced by missing values. Only the total count is visible -on the table returned to the client site. A message is also returned with the 1-dimensional; the message +is invalid all cells but the total count are replaced by missing values. Only the total count is visible +on the table returned to the client site. A message is also returned with the 1-dimensional; the message says "invalid table - invalid counts present" if the table is invalid and 'valid table' otherwise.

@@ -87,15 +87,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/table2DDS.html b/docs/reference/table2DDS.html index b5bacddc..b074faea 100644 --- a/docs/reference/table2DDS.html +++ b/docs/reference/table2DDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,19 +51,19 @@

table2DDS (aggregate function) called by ds.table2D

Arguments

-
xvect
+ + +
xvect

a numerical vector with discrete values - usually a factor.

-
yvect
+
yvect

a numerical vector with discrete values - usually a factor.

Value

- - -

a list which contains two elements: 'table', the 2-dimensional table and 'message' a message which +

a list which contains two elements: 'table', the 2-dimensional table and 'message' a message which informs about the validity of the table.

@@ -91,15 +91,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/tableDS.assign.html b/docs/reference/tableDS.assign.html index 3565adf7..05a8d9ff 100644 --- a/docs/reference/tableDS.assign.html +++ b/docs/reference/tableDS.assign.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -60,21 +60,23 @@

tableDS.assign is the serverside assign function called by ds.table

Arguments

-
rvar.transmit
+ + +
rvar.transmit

is a character string (in inverted commas) specifiying the name of the variable defining the rows in all of the 2 dimensional tables that form the output. Fully specified by <rvar> argument in ds.table. For more information see help for ds.table

-
cvar.transmit
+
cvar.transmit

is a character string specifiying the name of the variable defining the columns in all of the 2 dimensional tables that form the output. Fully specified by <cvar> argument in ds.table. For more information see help for ds.table

-
stvar.transmit
+
stvar.transmit

is a character string specifiying the name of the variable that indexes the separate two dimensional tables in the output if the call specifies a 3 dimensional table. @@ -82,38 +84,34 @@

Arguments

For more information see help for ds.table

-
rvar.all.unique.levels.transmit
+
rvar.all.unique.levels.transmit

is a character string containing all unique level in rvar, across the studies, separated by ','.

-
cvar.all.unique.levels.transmit
+
cvar.all.unique.levels.transmit

is a character string containing all unique level in cvar, across the studies, separated by ','.

-
stvar.all.unique.levels.transmit
+
stvar.all.unique.levels.transmit

is a character string containing all unique level in stvar, across the studies, separated by ','.

-
exclude.transmit
+
exclude.transmit

for information see help on <exclude> argument of ds.table. Fully specified by <exclude> argument of ds.table

-
useNA.transmit
+
useNA.transmit

for information see help on <useNA> argument of ds.table. Fully specified by <useNA> argument of ds.table

Value

- - -

For information see help for ds.table

- - +

For information see help for ds.table

Details

@@ -141,15 +139,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/tableDS.html b/docs/reference/tableDS.html index 38c21e21..9ceba897 100644 --- a/docs/reference/tableDS.html +++ b/docs/reference/tableDS.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -61,21 +61,23 @@

tableDS is the first of two serverside aggregate functions called by ds.tabl

Arguments

-
rvar.transmit
+ + +
rvar.transmit

is a character string (in inverted commas) specifiying the name of the variable defining the rows in all of the 2 dimensional tables that form the output. Fully specified by <rvar> argument in ds.table. For more information see help for ds.table

-
cvar.transmit
+
cvar.transmit

is a character string specifiying the name of the variable defining the columns in all of the 2 dimensional tables that form the output. Fully specified by <cvar> argument in ds.table. For more information see help for ds.table

-
stvar.transmit
+
stvar.transmit

is a character string specifiying the name of the variable that indexes the separate two dimensional tables in the output if the call specifies a 3 dimensional table. @@ -83,43 +85,39 @@

Arguments

For more information see help for ds.table

-
rvar.all.unique.levels.transmit
+
rvar.all.unique.levels.transmit

is a character string containing all unique level in rvar, across the studies, separated by ','.

-
cvar.all.unique.levels.transmit
+
cvar.all.unique.levels.transmit

is a character string containing all unique level in cvar, across the studies, separated by ','.

-
stvar.all.unique.levels.transmit
+
stvar.all.unique.levels.transmit

is a character string containing all unique level in stvar, across the studies, separated by ','.

-
exclude.transmit
+
exclude.transmit

for information see help on <exclude> argument of ds.table. Fully specified by <exclude> argument of ds.table

-
useNA.transmit
+
useNA.transmit

for information see help on <useNA> argument of ds.table. Fully specified by <useNA> argument of ds.table

-
force.nfilter.transmit
-

for information see help on <force.nfilter> argument +

force.nfilter.transmit
+

for information see help on <force.nfilter> argument of ds.table. Fully specified by <force.nfilter> argument of ds.table

Value

- - -

For information see help for ds.table

- - +

For information see help for ds.table

Details

@@ -145,15 +143,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/tableDS2.html b/docs/reference/tableDS2.html index 607b3242..898a093d 100644 --- a/docs/reference/tableDS2.html +++ b/docs/reference/tableDS2.html @@ -4,7 +4,7 @@ - +
@@ -30,13 +30,13 @@
- +
@@ -51,7 +51,9 @@

tableDS is the second of two serverside aggregate functions called by ds.tab

Arguments

-
newobj
+ + +
newobj

this a character string providing a name for the output table object to be written to the serverside if <table.assign> is TRUE. If no explicit name for the table object is specified, but <table.assign> @@ -60,21 +62,21 @@

Arguments

For more information see help for ds.table

-
rvar.transmit
+
rvar.transmit

is a character string (in inverted commas) specifiying the name of the variable defining the rows in all of the 2 dimensional tables that form the output. Fully specified by <rvar> argument in ds.table. For more information see help for ds.table

-
cvar.transmit
+
cvar.transmit

is a character string specifiying the name of the variable defining the columns in all of the 2 dimensional tables that form the output. Fully specified by <cvar> argument in ds.table. For more information see help for ds.table

-
stvar.transmit
+
stvar.transmit

is a character string specifiying the name of the variable that indexes the separate two dimensional tables in the output if the call specifies a 3 dimensional table. @@ -84,11 +86,7 @@

Arguments

Value

- - -

For information see help for ds.table

- - +

For information see help for ds.table

Details

@@ -115,15 +113,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/tapplyDS.assign.html b/docs/reference/tapplyDS.assign.html index e050c96c..25568b1a 100644 --- a/docs/reference/tapplyDS.assign.html +++ b/docs/reference/tapplyDS.assign.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,27 +53,27 @@

tapplyDS.assign called by ds.tapply.assign

Arguments

-
X.name,
+ + +
X.name,

the name of the variable to be summarized. Specified via argument <X.name> of ds.tapply.assign function

-
INDEX.names.transmit,
+
INDEX.names.transmit,

the name of a single factor or a vector of names of factors to index the variable to be summarized. Specified via argument <INDEX.names> of ds.tapply.assign function

-
FUN.name,
+
FUN.name,

the name of one of the allowable summarizing functions to be applied. Specified via argument <FUN.name> of ds.tapply.assign function.

Value

- - -

an array of the summarized values created by the tapplyDS.assign function. This +

an array of the summarized values created by the tapplyDS.assign function. This array is written as a newobj on the serverside. It has the same number of dimensions as INDEX.

@@ -97,15 +97,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/tapplyDS.html b/docs/reference/tapplyDS.html index 59bea5d4..355ed65e 100644 --- a/docs/reference/tapplyDS.html +++ b/docs/reference/tapplyDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,27 +53,27 @@

tapplyDS called by ds.tapply

Arguments

-
X.name,
+ + +
X.name,

the name of the variable to be summarized. Specified via argument <X.name> of ds.tapply function

-
INDEX.names.transmit,
+
INDEX.names.transmit,

the name of a single factor or a vector of names of factors to index the variable to be summarized. Specified via argument <INDEX.names> of ds.tapply function

-
FUN.name,
+
FUN.name,

the name of one of the allowable summarizing functions to be applied. Specified via argument <FUN.name> of ds.tapply function.

Value

- - -

an array of the summarized values created by the tapplyDS function. This array +

an array of the summarized values created by the tapplyDS function. This array is returned to the clientside. It has the same number of dimensions as INDEX.

@@ -97,15 +97,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/testObjExistsDS.html b/docs/reference/testObjExistsDS.html index 31563946..b71c4d55 100644 --- a/docs/reference/testObjExistsDS.html +++ b/docs/reference/testObjExistsDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,7 +49,9 @@

testObjExistsDS

Arguments

-
test.obj.name
+ + +
test.obj.name

a clientside provided character string specifying the variable whose presence is to be tested in each data source

@@ -78,15 +80,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/unListDS.html b/docs/reference/unListDS.html index 0f33763c..d895ac60 100644 --- a/docs/reference/unListDS.html +++ b/docs/reference/unListDS.html @@ -5,7 +5,7 @@ - +
@@ -31,13 +31,13 @@
- +
@@ -53,7 +53,9 @@

unListDS a serverside assign function called by ds.unList

Arguments

-
x.name
+ + +
x.name

the name of the input object to be unlisted. It must be specified in inverted commas e.g. x.name="input.object.name". Fully specified by the x.name argument of ds.unList

@@ -61,28 +63,20 @@

Arguments

Value

- - -

the object specified by the newobj argument of the +

the object specified by the newobj argument of the ds.unList function (or by default "unlist.newobj" if the newobj argument is NULL). This is written to the serverside. -As well as writing the output object as newobj

- - -

on the serverside, two validity messages are returned +As well as writing the output object as newobj +on the serverside, two validity messages are returned 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.seq 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 -studysideMessage from any datasource in which there was an error in creating newobj

- - -

and a studysideMessage was saved. Because the outcome object from ds.unList is +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 +studysideMessage from any datasource in which there was an error in creating newobj +and a studysideMessage was saved. Because the outcome object from ds.unList is typically a list object with no names, if there are no errors in creating it the message returned from ds.message("<newobj>") in each study will read "Outcome object is a list without names. So a studysideMessage may be hidden. @@ -114,15 +108,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/uniqueDS.html b/docs/reference/uniqueDS.html index e1df73f8..d133ead9 100644 --- a/docs/reference/uniqueDS.html +++ b/docs/reference/uniqueDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Applies the unique method to a server-side variable.

Arguments

-
x.name.transmit
+ + +
x.name.transmit

is the name of the variable upon which unique method will be applied

Value

- - -

the object specified by the newobj argument +

the object specified by the newobj argument which is written to the server-side.

@@ -81,15 +81,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/varDS.html b/docs/reference/varDS.html index f752e6fc..11f89d13 100644 --- a/docs/reference/varDS.html +++ b/docs/reference/varDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Computes the variance of vector

Arguments

-
xvect
+ + +
xvect

a vector

Value

- - -

a list, with the sum of the input variable, the sum of squares of the input variable, +

a list, with the sum of the input variable, the sum of squares of the input variable, the number of missing values, the number of valid values, the number of total length of the variable, and a study message indicating whether the number of valid is less than the disclosure threshold

@@ -84,15 +84,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/reference/vectorDS.html b/docs/reference/vectorDS.html index 2eeb8826..3f411ba9 100644 --- a/docs/reference/vectorDS.html +++ b/docs/reference/vectorDS.html @@ -3,7 +3,7 @@ - +
@@ -29,13 +29,13 @@
- +
@@ -49,15 +49,15 @@

Creates a vector on the server-side.

Arguments

-
...
+ + +
...

parameter to be used to form the vector.

Value

- - -

the object specified by the newobj argument +

the object specified by the newobj argument which is written to the server-side.

@@ -81,15 +81,15 @@

Author

-

Site built with pkgdown 2.0.9.

+

Site built with pkgdown 2.1.0.

- - + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 82cb7b07..265de84e 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -1,435 +1,147 @@ - - - - /404.html - - - /LICENSE.html - - - /authors.html - - - /index.html - - - /reference/BooleDS.html - - - /reference/absDS.html - - - /reference/asCharacterDS.html - - - /reference/asDataMatrixDS.html - - - /reference/asFactorDS1.html - - - /reference/asFactorDS2.html - - - /reference/asFactorSimpleDS.html - - - /reference/asIntegerDS.html - - - /reference/asListDS.html - - - /reference/asLogicalDS.html - - - /reference/asMatrixDS.html - - - /reference/asNumericDS.html - - - /reference/aucDS.html - - - /reference/blackBoxDS.html - - - /reference/blackBoxRanksDS.html - - - /reference/boxPlotGGDS.html - - - /reference/boxPlotGG_data_TreatmentDS.html - - - /reference/boxPlotGG_data_Treatment_numericDS.html - - - /reference/bp_standardsDS.html - - - /reference/cDS.html - - - /reference/cbindDS.html - - - /reference/changeRefGroupDS.html - - - /reference/checkNegValueDS.html - - - /reference/checkPermissivePrivacyControlLevel.html - - - /reference/classDS.html - - - /reference/colnamesDS.html - - - /reference/completeCasesDS.html - - - /reference/corDS.html - - - /reference/corTestDS.html - - - /reference/covDS.html - - - /reference/dataFrameDS.html - - - /reference/dataFrameFillDS.html - - - /reference/dataFrameSortDS.html - - - /reference/dataFrameSubsetDS1.html - - - /reference/dataFrameSubsetDS2.html - - - /reference/densityGridDS.html - - - /reference/dimDS.html - - - /reference/dmtC2SDS.html - - - /reference/elsplineDS.html - - - /reference/extract.html - - - /reference/extractQuantilesDS1.html - - - /reference/extractQuantilesDS2.html - - - /reference/gamlssDS.html - - - /reference/getWGSRDS.html - - - /reference/glmDS1.html - - - /reference/glmDS2.html - - - /reference/glmPredictDS.ag.html - - - /reference/glmPredictDS.as.html - - - /reference/glmSLMADS.assign.html - - - /reference/glmSLMADS1.html - - - /reference/glmSLMADS2.html - - - /reference/glmSummaryDS.ag.html - - - /reference/glmSummaryDS.as.html - - - /reference/glmerSLMADS.assign.html - - - /reference/glmerSLMADS.assing.html - - - /reference/glmerSLMADS2.html - - - /reference/heatmapPlotDS.html - - - /reference/hetcorDS.html - - - /reference/histogramDS1.html - - - /reference/histogramDS2.html - - - /reference/igb_standardsDS.html - - - /reference/index.html - - - /reference/isNaDS.html - - - /reference/isValidDS.html - - - /reference/kurtosisDS1.html - - - /reference/kurtosisDS2.html - - - /reference/lengthDS.html - - - /reference/levelsDS.html - - - /reference/lexisDS1.html - - - /reference/lexisDS2.html - - - /reference/lexisDS3.html - - - /reference/listDS.html - - - /reference/listDisclosureSettingsDS.html - - - /reference/lmerSLMADS.assign.html - - - /reference/lmerSLMADS2.html - - - /reference/lsDS.html - - - /reference/lsplineDS.html - - - /reference/matrixDS.html - - - /reference/matrixDetDS1.html - - - /reference/matrixDetDS2.html - - - /reference/matrixDiagDS.html - - - /reference/matrixDimnamesDS.html - - - /reference/matrixInvertDS.html - - - /reference/matrixMultDS.html - - - /reference/matrixTransposeDS.html - - - /reference/meanDS.html - - - /reference/meanSdGpDS.html - - - /reference/mergeDS.html - - - /reference/messageDS.html - - - /reference/metadataDS.html - - - /reference/miceDS.html - - - /reference/minMaxRandDS.html - - - /reference/namesDS.html - - - /reference/nsDS.html - - - /reference/numNaDS.html - - - /reference/qlsplineDS.html - - - /reference/quantileMeanDS.html - - - /reference/rBinomDS.html - - - /reference/rNormDS.html - - - /reference/rPoisDS.html - - - /reference/rUnifDS.html - - - /reference/rangeDS.html - - - /reference/ranksSecureDS1.html - - - /reference/ranksSecureDS2.html - - - /reference/ranksSecureDS3.html - - - /reference/ranksSecureDS4.html - - - /reference/ranksSecureDS5.html - - - /reference/rbindDS.html - - - /reference/reShapeDS.html - - - /reference/recodeLevelsDS.html - - - /reference/recodeValuesDS.html - - - /reference/repDS.html - - - /reference/replaceNaDS.html - - - /reference/rmDS.html - - - /reference/rowColCalcDS.html - - - /reference/sampleDS.html - - - /reference/scatterPlotDS.html - - - /reference/seqDS.html - - - /reference/setFilterDS.html - - - /reference/setSeedDS.html - - - /reference/skewnessDS1.html - - - /reference/skewnessDS2.html - - - /reference/sqrtDS.html - - - /reference/subsetByClassDS.html - - - /reference/subsetByClassHelper1.html - - - /reference/subsetByClassHelper2.html - - - /reference/subsetByClassHelper3.html - - - /reference/subsetDS.html - - - /reference/table1DDS.html - - - /reference/table2DDS.html - - - /reference/tableDS.assign.html - - - /reference/tableDS.html - - - /reference/tableDS2.html - - - /reference/tapplyDS.assign.html - - - /reference/tapplyDS.html - - - /reference/testObjExistsDS.html - - - /reference/unListDS.html - - - /reference/uniqueDS.html - - - /reference/varDS.html - - - /reference/vectorDS.html - + +/404.html +/LICENSE.html +/authors.html +/index.html +/reference/BooleDS.html +/reference/absDS.html +/reference/asCharacterDS.html +/reference/asDataMatrixDS.html +/reference/asFactorDS1.html +/reference/asFactorDS2.html +/reference/asFactorSimpleDS.html +/reference/asIntegerDS.html +/reference/asListDS.html +/reference/asLogicalDS.html +/reference/asMatrixDS.html +/reference/asNumericDS.html +/reference/aucDS.html +/reference/blackBoxDS.html +/reference/blackBoxRanksDS.html +/reference/boxPlotGGDS.html +/reference/boxPlotGG_data_TreatmentDS.html +/reference/boxPlotGG_data_Treatment_numericDS.html +/reference/bp_standardsDS.html +/reference/cDS.html +/reference/cbindDS.html +/reference/changeRefGroupDS.html +/reference/checkNegValueDS.html +/reference/checkPermissivePrivacyControlLevel.html +/reference/classDS.html +/reference/colnamesDS.html +/reference/completeCasesDS.html +/reference/corDS.html +/reference/corTestDS.html +/reference/covDS.html +/reference/dataFrameDS.html +/reference/dataFrameFillDS.html +/reference/dataFrameSortDS.html +/reference/dataFrameSubsetDS1.html +/reference/dataFrameSubsetDS2.html +/reference/densityGridDS.html +/reference/dimDS.html +/reference/dmtC2SDS.html +/reference/elsplineDS.html +/reference/extract.html +/reference/extractQuantilesDS1.html +/reference/extractQuantilesDS2.html +/reference/gamlssDS.html +/reference/getWGSRDS.html +/reference/glmDS1.html +/reference/glmDS2.html +/reference/glmPredictDS.ag.html +/reference/glmPredictDS.as.html +/reference/glmSLMADS.assign.html +/reference/glmSLMADS1.html +/reference/glmSLMADS2.html +/reference/glmSummaryDS.ag.html +/reference/glmSummaryDS.as.html +/reference/glmerSLMADS.assign.html +/reference/glmerSLMADS.assing.html +/reference/glmerSLMADS2.html +/reference/heatmapPlotDS.html +/reference/hetcorDS.html +/reference/histogramDS1.html +/reference/histogramDS2.html +/reference/igb_standardsDS.html +/reference/index.html +/reference/isNaDS.html +/reference/isValidDS.html +/reference/kurtosisDS1.html +/reference/kurtosisDS2.html +/reference/lengthDS.html +/reference/levelsDS.html +/reference/lexisDS1.html +/reference/lexisDS2.html +/reference/lexisDS3.html +/reference/listDS.html +/reference/listDisclosureSettingsDS.html +/reference/lmerSLMADS.assign.html +/reference/lmerSLMADS2.html +/reference/lsDS.html +/reference/lsplineDS.html +/reference/matrixDS.html +/reference/matrixDetDS1.html +/reference/matrixDetDS2.html +/reference/matrixDiagDS.html +/reference/matrixDimnamesDS.html +/reference/matrixInvertDS.html +/reference/matrixMultDS.html +/reference/matrixTransposeDS.html +/reference/meanDS.html +/reference/meanSdGpDS.html +/reference/mergeDS.html +/reference/messageDS.html +/reference/metadataDS.html +/reference/miceDS.html +/reference/minMaxRandDS.html +/reference/namesDS.html +/reference/nsDS.html +/reference/numNaDS.html +/reference/qlsplineDS.html +/reference/quantileMeanDS.html +/reference/rBinomDS.html +/reference/rNormDS.html +/reference/rPoisDS.html +/reference/rUnifDS.html +/reference/rangeDS.html +/reference/ranksSecureDS1.html +/reference/ranksSecureDS2.html +/reference/ranksSecureDS3.html +/reference/ranksSecureDS4.html +/reference/ranksSecureDS5.html +/reference/rbindDS.html +/reference/reShapeDS.html +/reference/recodeLevelsDS.html +/reference/recodeValuesDS.html +/reference/repDS.html +/reference/replaceNaDS.html +/reference/rmDS.html +/reference/rowColCalcDS.html +/reference/sampleDS.html +/reference/scatterPlotDS.html +/reference/seqDS.html +/reference/setFilterDS.html +/reference/setSeedDS.html +/reference/skewnessDS1.html +/reference/skewnessDS2.html +/reference/sqrtDS.html +/reference/subsetByClassDS.html +/reference/subsetByClassHelper1.html +/reference/subsetByClassHelper2.html +/reference/subsetByClassHelper3.html +/reference/subsetDS.html +/reference/table1DDS.html +/reference/table2DDS.html +/reference/tableDS.assign.html +/reference/tableDS.html +/reference/tableDS2.html +/reference/tapplyDS.assign.html +/reference/tapplyDS.html +/reference/testObjExistsDS.html +/reference/unListDS.html +/reference/uniqueDS.html +/reference/varDS.html +/reference/vectorDS.html + From 52903081c76f7064de6d7bf07178e4113ead3c69 Mon Sep 17 00:00:00 2001 From: Tim Cadman <41470917+timcadman@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:05:33 +0100 Subject: [PATCH 02/24] feat: added standardise function --- R/standardiseDfDS.R | 88 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 R/standardiseDfDS.R diff --git a/R/standardiseDfDS.R b/R/standardiseDfDS.R new file mode 100644 index 00000000..35e15e6e --- /dev/null +++ b/R/standardiseDfDS.R @@ -0,0 +1,88 @@ +#' Get the Class of All Columns in a Data Frame +#' @param df.name A string representing the name of the data frame. +#' @return A tibble with the class of each column in the data frame. +#' @importFrom dplyr %>% +#' @importFrom tibble as_tibble +#' @importFrom purrr map +#' @export +getClassAllColsDS <- function(df.name){ + df.name <- eval(parse(text = df.name), envir = parent.frame()) + all_classes <- map(df.name, class) %>% as_tibble() + return(all_classes) +} + +#' Change Class of Target Variables in a Data Frame +#' @param df.name A string representing the name of the data frame. +#' @param target_vars A character vector specifying the columns to be modified. +#' @param target_class A character vector specifying the new classes for each column (1 = factor, +#' 2 = integer, 3 = numeric, 4 = character, 5 = logical). +#' @return A modified data frame with the specified columns converted to the target classes. +#' @importFrom dplyr mutate across +#' @importFrom tidyselect all_of +#' @export +fixClassDS <- function(df.name, target_vars, target_class) { + df <- eval(parse(text = df.name), envir = parent.frame()) + df_transformed <- df %>% + mutate( + across(all_of(target_vars), + ~ .convertClass(.x, target_class[which(target_vars == cur_column())]))) + return(df_transformed) +} + +#' Convert a Vector to a Specified Class +#' @param x The vector to be converted. +#' @param class_name A string indicating the target class (1 = factor, 2 = integer, 3 = numeric, +#' 4 = character, 5 = logical). +#' @return The converted vector. +#' @noRd +.convertClass <- function(target_var, target_class_code) { + switch(target_class_code, + "1" = as.factor(target_var), + "2" = as.integer(target_var), + "3" = as.numeric(target_var), + "4" = as.character(target_var), + "5" = as.logical(target_var) + ) +} + +#' Add Missing Columns with NA Values +#' @param .data A string representing the name of the data frame. +#' @param cols A character vector specifying the columns to be added if missing. +#' @return A modified data frame with missing columns added and filled with NA. +#' @importFrom dplyr mutate select +#' @importFrom tidyselect peek_vars +#' @importFrom purrr set_names +#' @export +fixColsDS <- function(.data, cols) { + .data <- eval(parse(text = .data), envir = parent.frame()) + missing <- setdiff(cols, colnames(.data)) + out <- .data %>% + mutate(!!!set_names(rep(list(NA), length(missing)), missing)) %>% + select(sort(peek_vars())) + return(out) +} + +#' Retrieve Factor Levels for Specific Columns +#' @param df.name A string representing the name of the data frame. +#' @param factor_vars A character vector specifying the factor columns. +#' @return A list of factor levels for the specified columns. +#' @importFrom tidyselect all_of +#' @importFrom purrr map +#' @export +getAllLevelsDS <- function(df.name, factor_vars) { + df <- eval(parse(text = df.name), envir = parent.frame()) + return(df %>% dplyr::select(all_of(factor_vars)) %>% map(levels)) +} + + +#' Set Factor Levels for Specific Columns in a Data Frame +#' @param df.name A string representing the name of the data frame to modify. +#' @param vars A character vector specifying the columns to be modified. +#' @param levels A named list where each element contains the levels for the corresponding factor variable. +#' @return A modified data frame with the specified columns converted to factors with the provided levels. +#' @export +fixLevelsDS <- function(df.name, vars, levels) { + df.name <- eval(parse(text = df.name), envir = parent.frame()) + out <- df.name %>% + mutate(across(all_of(vars), ~factor(., levels = levels[[dplyr::cur_column()]]))) +} From 8846c54f867efce396754b0f4c8582fcaab6b7e6 Mon Sep 17 00:00:00 2001 From: Tim Cadman <41470917+timcadman@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:05:48 +0100 Subject: [PATCH 03/24] chore: added additional dependencies --- DESCRIPTION | 5 ++++- NAMESPACE | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2c8ded58..ef166831 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,7 +18,10 @@ Imports: gamlss, gamlss.dist, mice, - childsds + childsds, + purrr, + tibble, + tidyselect Suggests: testthat AggregateMethods: diff --git a/NAMESPACE b/NAMESPACE index 897148d1..e7036282 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -41,7 +41,12 @@ export(dmtC2SDS) export(elsplineDS) export(extractQuantilesDS1) export(extractQuantilesDS2) +export(fixClassDS) +export(fixColsDS) +export(fixLevelsDS) export(gamlssDS) +export(getAllLevelsDS) +export(getClassAllColsDS) export(getWGSRDS) export(glmDS1) export(glmDS2) @@ -138,5 +143,14 @@ import(dplyr) import(gamlss) import(gamlss.dist) import(mice) +importFrom(dplyr,"%>%") +importFrom(dplyr,across) +importFrom(dplyr,mutate) +importFrom(dplyr,select) importFrom(gamlss.dist,pST3) importFrom(gamlss.dist,qST3) +importFrom(purrr,map) +importFrom(purrr,set_names) +importFrom(tibble,as_tibble) +importFrom(tidyselect,all_of) +importFrom(tidyselect,peek_vars) From 2ffa3183267821481d4809e8d12c3709a8c07aaf Mon Sep 17 00:00:00 2001 From: Tim Cadman <41470917+timcadman@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:05:58 +0100 Subject: [PATCH 04/24] test: added tests --- tests/testthat/helper.R | 162 ++++++++++++++++++++++++++ tests/testthat/test-standardiseDfDS.R | 146 +++++++++++++++++++++++ 2 files changed, 308 insertions(+) create mode 100644 tests/testthat/helper.R create mode 100644 tests/testthat/test-standardiseDfDS.R diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R new file mode 100644 index 00000000..e27e90e5 --- /dev/null +++ b/tests/testthat/helper.R @@ -0,0 +1,162 @@ +#' Create a mixed dataframe with factor and other types of columns +#' +#' This function generates a dataframe with a specified number of rows, +#' factor columns, and other columns (integer, numeric, and string). +#' +#' @param n_rows Number of rows in the dataframe. Default is 10,000. +#' @param n_factor_cols Number of factor columns in the dataframe. Default is 15. +#' @param n_other_cols Number of other columns (integer, numeric, and string) in the dataframe. Default is 15. +#' +#' @return A dataframe with the specified number of rows and columns, containing mixed data types. +#' @importFrom dplyr bind_cols +#' @importFrom purrr map_dfc +#' @examples +#' df <- create_mixed_dataframe(n_rows = 100, n_factor_cols = 10, n_other_cols = 5) +create_mixed_dataframe <- function(n_rows = 10000, n_factor_cols = 15, n_other_cols = 15) { + + create_factor_column <- function(levels, n = n_rows) { + set.seed(123) # Set seed before sample + factor(sample(levels, n, replace = TRUE)) + } + + factor_levels <- list( + c("Low", "Medium", "High"), + c("Red", "Green", "Blue"), + c("Yes", "No"), + c("A", "B", "C"), + c("One", "Two", "Three"), + c("Cat", "Dog", "Bird"), + c("Small", "Medium", "Large"), + c("Alpha", "Beta", "Gamma"), + c("True", "False"), + c("Left", "Right"), + c("North", "South", "East", "West"), + c("Day", "Night"), + c("Up", "Down"), + c("Male", "Female"), + c("Summer", "Winter", "Spring", "Fall") + ) + + factor_columns <- map_dfc(factor_levels[1:n_factor_cols], create_factor_column) + colnames(factor_columns) <- paste0("fac_col", 1:n_factor_cols) + + create_other_column <- function(type, n = n_rows) { + set.seed(123) # Set seed before sample + switch(type, + "int" = sample(1:100, n, replace = TRUE), + "num" = runif(n, 0, 100), + "str" = sample(letters, n, replace = TRUE) + ) + } + + column_types <- c( + "int", "int", "num", "num", "str", + "str", "int", "num", "str", "int", + "num", "str", "int", "num", "str" + ) + + other_columns <- map_dfc(column_types[1:n_other_cols], create_other_column) + colnames(other_columns) <- paste0("col", (n_factor_cols + 1):(n_factor_cols + n_other_cols)) + df <- bind_cols(factor_columns, other_columns) + + return(df) +} + + +#' Modify factor levels for partial overlap +#' +#' This function takes two sets of factor levels, computes the common and unique levels, +#' and returns a new set of levels with partial overlap. +#' +#' @param levels1 First set of factor levels. +#' @param levels2 Second set of factor levels. +#' +#' @return A character vector of new factor levels with partial overlap. +#' @examples +#' new_levels <- partial_overlap_levels(c("A", "B", "C"), c("B", "C", "D")) +partial_overlap_levels <- function(levels1, levels2) { + common <- intersect(levels1, levels2) + unique1 <- setdiff(levels1, common) + unique2 <- setdiff(levels2, common) + + # Set seed before each sample call + set.seed(123) + sampled_unique1 <- sample(unique1, length(unique1) * 0.5) + + set.seed(123) + sampled_unique2 <- sample(unique2, length(unique2) * 0.5) + + new_levels <- c(common, sampled_unique1, sampled_unique2) + return(new_levels) +} + + +#' Create additional dataframes with specific conditions +#' +#' This function generates additional dataframes based on an input dataframe, modifying column classes and levels, +#' and adding new columns with unique names. Different seeds are used for each iteration of the loop, +#' ensuring reproducibility of the generated dataframes. +#' +#' @param base_df The base dataframe used to create the additional dataframes. +#' @param n_rows Number of rows in the additional dataframes. Default is 10,000. +#' @param df_names Names of the additional dataframes to be created. Default is c("df1", "df2", "df3"). +#' +#' @return A list of dataframes with the specified modifications. +#' @importFrom dplyr bind_cols +#' @examples +#' base_df <- create_mixed_dataframe(n_rows = 100, n_factor_cols = 10, n_other_cols = 5) +#' additional_dfs <- create_additional_dataframes(base_df, n_rows = 1000, df_names = c("df1", "df2")) +create_additional_dataframes <- function(base_df, n_rows = 10000, df_names = c("df1", "df2", "df3")) { + + # Define a fixed sequence of seeds, one for each dataframe to be created + seeds <- c(123, 456, 789, 101112) + + df_list <- list() + + for (i in seq_along(df_names)) { + # Set the seed for this iteration based on the pre-defined seeds + set.seed(seeds[i]) + + # Proceed with the dataframe generation process + overlap_cols <- sample(colnames(base_df), size = round(0.8 * ncol(base_df))) + df <- base_df + cols_to_modify_class <- sample(overlap_cols, size = round(0.2 * length(overlap_cols))) + + # Modify columns to have different data types + for (col in cols_to_modify_class) { + current_class <- class(df[[col]]) + new_class <- switch(current_class, + "factor" = as.character(df[[col]]), + "character" = as.factor(df[[col]]), + "numeric" = as.integer(df[[col]]), + "integer" = as.numeric(df[[col]]), + df[[col]]) + df[[col]] <- new_class + } + + # Modify factor levels for partial overlap + factor_cols <- colnames(base_df)[sapply(base_df, is.factor)] + overlap_factor_cols <- intersect(overlap_cols, factor_cols) + cols_to_modify_levels <- sample(overlap_factor_cols, size = round(0.5 * length(overlap_factor_cols))) + + for (col in cols_to_modify_levels) { + original_levels <- levels(base_df[[col]]) + new_levels <- partial_overlap_levels(original_levels, original_levels) + df[[col]] <- factor(df[[col]], levels = new_levels) + } + + # Create new random columns for each dataframe (these will vary by seed) + set.seed(seeds[i]) # Set the seed again for generating new columns + n_new_cols <- round(0.2 * ncol(base_df)) + new_col_names <- paste0(df_names[i], "_new_col_", 1:n_new_cols) + new_cols <- data.frame(matrix(runif(n_rows * n_new_cols), ncol = n_new_cols)) + colnames(new_cols) <- new_col_names + + # Bind new columns to the dataframe + df <- bind_cols(df, new_cols) + df_list[[df_names[i]]] <- df + } + + return(df_list) +} + diff --git a/tests/testthat/test-standardiseDfDS.R b/tests/testthat/test-standardiseDfDS.R new file mode 100644 index 00000000..7327e1b1 --- /dev/null +++ b/tests/testthat/test-standardiseDfDS.R @@ -0,0 +1,146 @@ +library(DSLite) +library(dsTidyverse) +library(dsBase) +library(dsBaseClient) +library(DSI) +library(purrr) +library(dplyr) + +df <- create_mixed_dataframe() +df_list <- create_additional_dataframes(df) + +df_1 <- df +df_2 <- df_list[[1]] +df_3 <- df_list[[2]] +df_4 <- df_list[[3]] + +test_that("getClassAllColsDS returns correct classes", { + expect_equal( + getClassAllColsDS("df_1"), + tibble( + fac_col1 = "factor", fac_col2 = "factor", fac_col3 = "factor", fac_col4 = "factor", fac_col5 = "factor", + fac_col6 = "factor", fac_col7 = "factor", fac_col8 = "factor", fac_col9 = "factor", fac_col10 = "factor", + fac_col11 = "factor", fac_col12 = "factor", fac_col13 = "factor", fac_col14 = "factor", fac_col15 = "factor", + col16 = "integer", col17 = "integer", col18 = "numeric", col19 = "numeric", col20 = "character", + col21 = "character", col22 = "integer", col23 = "numeric", col24 = "character", col25 = "integer", + col26 = "numeric", col27 = "character", col28 = "integer", col29 = "numeric", col30 = "character" + ) + ) +}) + +test_that("fixClassDS sets classes correctly", { + + cols_to_set <- c("fac_col13", "fac_col5", "col22", "col19", "col25", "col20", "col28", + "fac_col14", "fac_col3", "fac_col8") + + classes_to_set <- c("4", "1", "3", "5", "3", "2", "5", "5", "3", "2") + + expect_warning( + classes_changed_df <- fixClassDS("df_1", cols_to_set, classes_to_set) + ) + + expect_equal( + classes_changed_df %>% map_chr(class) %>% unname(), + c("factor", "factor", "numeric", "factor", "factor", "factor", "factor", "integer", "factor", + "factor", "factor", "factor", "character", "logical", "factor", "integer", "integer", + "numeric", "logical", "integer", "character", "numeric", "numeric", "character", "numeric", + "numeric", "character", "logical", "numeric", "character") + ) +}) + +test_that("convert_class calls the correct function", { + +result <- .convertClass(c(1, 2, 3), "1") +expect_true(is.factor(result)) + +result <- .convertClass(c(1.5, 2.5, 3.7), "2") +expect_true(is.integer(result)) + +result <- .convertClass(c("1", "2", "3"), "3") +expect_true(is.numeric(result)) + +result <- .convertClass(c(1, 2, 3), "4") +expect_true(is.character(result)) + +result <- .convertClass(c(0, 1, 0), "5") +expect_true(is.logical(result)) + +}) + +test_that("fixColsDS correctly adds missing columns", { + + all_cols <- unique(c(colnames(df_1), colnames(df_2), colnames(df_3), colnames(df_4))) + out <- fixColsDS("df_3", all_cols) + + expect_equal( + colnames(out), + sort(all_cols)) + +}) + +test_that("getAllLevelsDS correctly retrieves the levels of specified factor columns", { + + factor_vars <- c("fac_col1", "fac_col2", "fac_col3", "fac_col4", "fac_col5", "fac_col6", "fac_col7", + "fac_col8", "fac_col9", "fac_col10", "fac_col11", "fac_col12", "fac_col14", + "fac_col15", "col27") + + observed <- getAllLevelsDS("df_3", factor_vars) + + expected <- list( + fac_col1 = c("High", "Low", "Medium"), + fac_col2 = c("Blue", "Green", "Red"), + fac_col3 = c("No", "Yes"), + fac_col4 = c("A", "B", "C"), + fac_col5 = c("One", "Three", "Two"), + fac_col6 = c("Bird", "Cat", "Dog"), + fac_col7 = c("Large", "Medium", "Small"), + fac_col8 = c("Alpha", "Beta", "Gamma"), + fac_col9 = c("False", "True"), + fac_col10 = c("Left", "Right"), + fac_col11 = c("East", "North", "South", "West"), + fac_col12 = c("Day", "Night"), + fac_col14 = c("Female", "Male"), + fac_col15 = c("Fall", "Spring", "Summer", "Winter"), + col27 = letters + ) + + expect_equal(expected, observed) + +}) + +example_df <- data.frame( + col1 = c("A", "B", "A", "C"), + col2 = c("X", "Y", "X", "Z"), + col3 = c("Yes", "No", "Yes", "No"), + stringsAsFactors = FALSE +) + +test_that("fixLevelsDS sets factor levels correctly", { + + levels <- list( + col1 = c("A", "B", "C"), + col2 = c("X", "Y", "Z"), + col3 = c("Yes", "No") + ) + + modified_df <- fixLevelsDS("example_df", c("col1", "col2", "col3"), levels) + + expect_s3_class(modified_df$col1, "factor") + expect_s3_class(modified_df$col2, "factor") + expect_s3_class(modified_df$col3, "factor") + + expect_equal(levels(modified_df$col1), levels$col1) + expect_equal(levels(modified_df$col2), levels$col2) + expect_equal(levels(modified_df$col3), levels$col3) + +}) + +test_that("fixLevelsDS throws an error for invalid input", { + + levels <- list( + col1 = c("A", "B", "C"), + col2 = c("X", "Y", "Z") + ) + + expect_error(fixLevelsDS("example_df", c("col1", "non_existent_col"), levels)) +}) From c2ffbe9c9052a2c1f7f01e6c045a5a487311c370 Mon Sep 17 00:00:00 2001 From: Tim Cadman <41470917+timcadman@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:06:11 +0100 Subject: [PATCH 05/24] docs: added docs for functions --- man/fixClassDS.Rd | 22 ++++++++++++++++++++++ man/fixColsDS.Rd | 19 +++++++++++++++++++ man/fixLevelsDS.Rd | 21 +++++++++++++++++++++ man/getAllLevelsDS.Rd | 19 +++++++++++++++++++ man/getClassAllColsDS.Rd | 17 +++++++++++++++++ 5 files changed, 98 insertions(+) create mode 100644 man/fixClassDS.Rd create mode 100644 man/fixColsDS.Rd create mode 100644 man/fixLevelsDS.Rd create mode 100644 man/getAllLevelsDS.Rd create mode 100644 man/getClassAllColsDS.Rd diff --git a/man/fixClassDS.Rd b/man/fixClassDS.Rd new file mode 100644 index 00000000..d7b6bf17 --- /dev/null +++ b/man/fixClassDS.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/standardiseDfDS.R +\name{fixClassDS} +\alias{fixClassDS} +\title{Change Class of Target Variables in a Data Frame} +\usage{ +fixClassDS(df.name, target_vars, target_class) +} +\arguments{ +\item{df.name}{A string representing the name of the data frame.} + +\item{target_vars}{A character vector specifying the columns to be modified.} + +\item{target_class}{A character vector specifying the new classes for each column (1 = factor, +2 = integer, 3 = numeric, 4 = character, 5 = logical).} +} +\value{ +A modified data frame with the specified columns converted to the target classes. +} +\description{ +Change Class of Target Variables in a Data Frame +} diff --git a/man/fixColsDS.Rd b/man/fixColsDS.Rd new file mode 100644 index 00000000..709d9472 --- /dev/null +++ b/man/fixColsDS.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/standardiseDfDS.R +\name{fixColsDS} +\alias{fixColsDS} +\title{Add Missing Columns with NA Values} +\usage{ +fixColsDS(.data, cols) +} +\arguments{ +\item{.data}{A string representing the name of the data frame.} + +\item{cols}{A character vector specifying the columns to be added if missing.} +} +\value{ +A modified data frame with missing columns added and filled with NA. +} +\description{ +Add Missing Columns with NA Values +} diff --git a/man/fixLevelsDS.Rd b/man/fixLevelsDS.Rd new file mode 100644 index 00000000..096757a9 --- /dev/null +++ b/man/fixLevelsDS.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/standardiseDfDS.R +\name{fixLevelsDS} +\alias{fixLevelsDS} +\title{Set Factor Levels for Specific Columns in a Data Frame} +\usage{ +fixLevelsDS(df.name, vars, levels) +} +\arguments{ +\item{df.name}{A string representing the name of the data frame to modify.} + +\item{vars}{A character vector specifying the columns to be modified.} + +\item{levels}{A named list where each element contains the levels for the corresponding factor variable.} +} +\value{ +A modified data frame with the specified columns converted to factors with the provided levels. +} +\description{ +Set Factor Levels for Specific Columns in a Data Frame +} diff --git a/man/getAllLevelsDS.Rd b/man/getAllLevelsDS.Rd new file mode 100644 index 00000000..e5030725 --- /dev/null +++ b/man/getAllLevelsDS.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/standardiseDfDS.R +\name{getAllLevelsDS} +\alias{getAllLevelsDS} +\title{Retrieve Factor Levels for Specific Columns} +\usage{ +getAllLevelsDS(df.name, factor_vars) +} +\arguments{ +\item{df.name}{A string representing the name of the data frame.} + +\item{factor_vars}{A character vector specifying the factor columns.} +} +\value{ +A list of factor levels for the specified columns. +} +\description{ +Retrieve Factor Levels for Specific Columns +} diff --git a/man/getClassAllColsDS.Rd b/man/getClassAllColsDS.Rd new file mode 100644 index 00000000..cb2de0e7 --- /dev/null +++ b/man/getClassAllColsDS.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/standardiseDfDS.R +\name{getClassAllColsDS} +\alias{getClassAllColsDS} +\title{Get the Class of All Columns in a Data Frame} +\usage{ +getClassAllColsDS(df.name) +} +\arguments{ +\item{df.name}{A string representing the name of the data frame.} +} +\value{ +A tibble with the class of each column in the data frame. +} +\description{ +Get the Class of All Columns in a Data Frame +} From d55127c57f8bf298c62b3d8d9f3f239a1f38e254 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Tue, 14 Jan 2025 14:41:28 +0000 Subject: [PATCH 06/24] Restructure recode and dependencies --- DESCRIPTION | 4 +- ...rdiseDfDS.R => test-smk-standardiseDfDS.R} | 51 ++++++++++++------- 2 files changed, 37 insertions(+), 18 deletions(-) rename tests/testthat/{test-standardiseDfDS.R => test-smk-standardiseDfDS.R} (78%) diff --git a/DESCRIPTION b/DESCRIPTION index 3a3ec44d..bf8e3029 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,7 +21,9 @@ Imports: childsds, purrr, tibble, - tidyselect + tidyselect, + tidytable, + tidyverse Suggests: testthat AggregateMethods: diff --git a/tests/testthat/test-standardiseDfDS.R b/tests/testthat/test-smk-standardiseDfDS.R similarity index 78% rename from tests/testthat/test-standardiseDfDS.R rename to tests/testthat/test-smk-standardiseDfDS.R index 7327e1b1..64c7ba4d 100644 --- a/tests/testthat/test-standardiseDfDS.R +++ b/tests/testthat/test-smk-standardiseDfDS.R @@ -1,10 +1,18 @@ -library(DSLite) -library(dsTidyverse) -library(dsBase) -library(dsBaseClient) -library(DSI) -library(purrr) -library(dplyr) +#------------------------------------------------------------------------------- +# Copyright (c) 2025 University Medical Center Groningen (UCMG), Netherlands. All rights reserved. +# +# This program and the accompanying materials +# are made available under the terms of the GNU Public License v3.0. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +#------------------------------------------------------------------------------- + +# +# Set up +# + +context("standardiseDfDS::smk::setup") df <- create_mixed_dataframe() df_list <- create_additional_dataframes(df) @@ -14,6 +22,7 @@ df_2 <- df_list[[1]] df_3 <- df_list[[2]] df_4 <- df_list[[3]] +context("standardiseDfDS::smk") test_that("getClassAllColsDS returns correct classes", { expect_equal( getClassAllColsDS("df_1"), @@ -50,20 +59,20 @@ test_that("fixClassDS sets classes correctly", { test_that("convert_class calls the correct function", { -result <- .convertClass(c(1, 2, 3), "1") -expect_true(is.factor(result)) + result <- .convertClass(c(1, 2, 3), "1") + expect_true(is.factor(result)) -result <- .convertClass(c(1.5, 2.5, 3.7), "2") -expect_true(is.integer(result)) + result <- .convertClass(c(1.5, 2.5, 3.7), "2") + expect_true(is.integer(result)) -result <- .convertClass(c("1", "2", "3"), "3") -expect_true(is.numeric(result)) + result <- .convertClass(c("1", "2", "3"), "3") + expect_true(is.numeric(result)) -result <- .convertClass(c(1, 2, 3), "4") -expect_true(is.character(result)) + result <- .convertClass(c(1, 2, 3), "4") + expect_true(is.character(result)) -result <- .convertClass(c(0, 1, 0), "5") -expect_true(is.logical(result)) + result <- .convertClass(c(0, 1, 0), "5") + expect_true(is.logical(result)) }) @@ -144,3 +153,11 @@ test_that("fixLevelsDS throws an error for invalid input", { expect_error(fixLevelsDS("example_df", c("col1", "non_existent_col"), levels)) }) + +# +# Done +# + +context("standardiseDfDS::smk::shutdown") + +context("standardiseDfDS::smk::done") From b50d7968e31fd2431424373340c0b23b28a1d0ba Mon Sep 17 00:00:00 2001 From: davraam Date: Fri, 17 Jan 2025 16:55:43 +0200 Subject: [PATCH 07/24] remove deprecated ds.subset/subsetDS and tidy up some code --- DESCRIPTION | 1 - NAMESPACE | 1 - R/asCharacterDS.R | 2 +- R/asDataMatrixDS.R | 6 +- R/asFactorDS1.R | 25 ++-- R/asListDS.R | 14 +- R/asLogicalDS.R | 18 +-- R/aucDS.R | 2 +- R/minMaxRandDS.R | 7 +- R/subsetDS.R | 134 ----------------- R/tableDS.R | 223 ++++++++++++----------------- docs/reference/subsetDS.html | 142 ------------------ man/subsetDS.Rd | 57 -------- tests/testthat/test-smk-subsetDS.R | 125 ---------------- 14 files changed, 133 insertions(+), 624 deletions(-) delete mode 100644 R/subsetDS.R delete mode 100644 docs/reference/subsetDS.html delete mode 100644 man/subsetDS.Rd delete mode 100644 tests/testthat/test-smk-subsetDS.R diff --git a/DESCRIPTION b/DESCRIPTION index bf8e3029..d92b0b05 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -164,7 +164,6 @@ AssignMethods: seqDS, sqrtDS, subsetByClassDS, - subsetDS, tableDS.assign, tapplyDS.assign, uniqueDS, diff --git a/NAMESPACE b/NAMESPACE index e7036282..113ffe4b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -125,7 +125,6 @@ export(skewnessDS1) export(skewnessDS2) export(sqrtDS) export(subsetByClassDS) -export(subsetDS) export(table1DDS) export(table2DDS) export(tableDS) diff --git a/R/asCharacterDS.R b/R/asCharacterDS.R index 1d6013e5..04b6b70a 100644 --- a/R/asCharacterDS.R +++ b/R/asCharacterDS.R @@ -14,7 +14,7 @@ #' asCharacterDS <- function (x.name){ - x<-eval(parse(text=x.name), envir = parent.frame()) + x <- eval(parse(text=x.name), envir = parent.frame()) output <- as.character(x) return(output) diff --git a/R/asDataMatrixDS.R b/R/asDataMatrixDS.R index 5add2f63..001aec0d 100644 --- a/R/asDataMatrixDS.R +++ b/R/asDataMatrixDS.R @@ -1,3 +1,4 @@ +#' #' @title asDataMatrixDS a serverside assign function called by ds.asDataMatrix #' @description Coerces an R object into a matrix maintaining original #' class for all columns in data.frames. @@ -16,15 +17,16 @@ #' details see help on the clientside function \code{ds.asDataMatrix} #' @author Paul Burton for DataSHIELD Development Team #' @export +#' asDataMatrixDS <- function (x.name){ if(is.character(x.name)){ - x<-eval(parse(text=x.name), envir = parent.frame()) + x <- eval(parse(text=x.name), envir = parent.frame()) }else{ studysideMessage<-"ERROR: x.name must be specified as a character string" stop(studysideMessage, call. = FALSE) - } + } output <- data.matrix(x) diff --git a/R/asFactorDS1.R b/R/asFactorDS1.R index 6d4f0507..7a3a4e1a 100644 --- a/R/asFactorDS1.R +++ b/R/asFactorDS1.R @@ -10,6 +10,7 @@ #' @export #' asFactorDS1 <- function(input.var.name=NULL){ + ################################################################## #MODULE 1: CAPTURE THE nfilter SETTINGS # thr<-dsBase::listDisclosureSettingsDS() # @@ -26,27 +27,29 @@ asFactorDS1 <- function(input.var.name=NULL){ input.var <- eval(parse(text=input.var.name), envir = parent.frame()) factor.levels.present.in.source <- levels(factor(input.var)) - num.levels<-length(factor.levels.present.in.source) + num.levels <- length(factor.levels.present.in.source) max.levels.by.density<-nfilter.levels.density*length(input.var) - if(num.levels>nfilter.levels.max) - { - error.message<- - 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") + if(num.levels > nfilter.levels.max){ + error.message <- 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") stop(error.message, call. = FALSE) } - if(num.levels>(length(input.var)*nfilter.levels.density)) - { - error.message<- - 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") + if(num.levels > (length(input.var)*nfilter.levels.density)){ + error.message <- 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") stop(error.message, call. = FALSE) } return(factor.levels.present.in.source) } -#AGGREGATE FUNCTION +# AGGREGATE FUNCTION # asFactorDS1 - diff --git a/R/asListDS.R b/R/asListDS.R index 31da5f0b..0029526b 100644 --- a/R/asListDS.R +++ b/R/asListDS.R @@ -1,3 +1,4 @@ +#' #' @title asListDS a serverside aggregate function called by ds.asList #' @description Coerces an R object into a list #' @details Unlike most other class coercing functions this is @@ -21,25 +22,26 @@ #' the class of the output object should usually be 'list' #' @author Amadou Gaye, Paul Burton for DataSHIELD Development Team #' @export +#' asListDS <- function (x.name, newobj){ newobj.class <- NULL if(is.character(x.name)){ - active.text<-paste0(newobj,"<-as.list(",x.name,")") + active.text <- paste0(newobj,"<-as.list(",x.name,")") eval(parse(text=active.text), envir = parent.frame()) - active.text2<-paste0("class(",newobj,")") + active.text2 <- paste0("class(",newobj,")") assign("newobj.class", eval(parse(text=active.text2), envir = parent.frame())) }else{ - studysideMessage<-"ERROR: x.name must be specified as a character string" + studysideMessage <- "ERROR: x.name must be specified as a character string" stop(studysideMessage, call. = FALSE) } - return.message<-paste0("New object <",newobj,"> created") - object.class.text<-paste0("Class of <",newobj,"> is '",newobj.class,"'") + return.message <- paste0("New object <", newobj, "> created") + object.class.text <- paste0("Class of <", newobj, "> is '", newobj.class, "'") - return(list(return.message=return.message,class.of.newobj=object.class.text)) + return(list(return.message=return.message, class.of.newobj=object.class.text)) } # AGGEGATE FUNCTION # asListDS diff --git a/R/asLogicalDS.R b/R/asLogicalDS.R index 4a1725f5..26199153 100644 --- a/R/asLogicalDS.R +++ b/R/asLogicalDS.R @@ -1,3 +1,4 @@ +#' #' @title Coerces an R object into class numeric #' @description this function is based on the native R function \code{as.numeric} #' @details See help for function \code{as.logical} in native R @@ -10,24 +11,25 @@ #' details see help on the clientside function \code{ds.asLogical} #' @author Amadou Gaye, Paul Burton for DataSHIELD Development Team #' @export +#' asLogicalDS <- function (x.name){ -if(is.character(x.name)){ - x<-eval(parse(text=x.name), envir = parent.frame()) + if(is.character(x.name)){ + x <- eval(parse(text=x.name), envir = parent.frame()) }else{ - studysideMessage<-"ERROR: x.name must be specified as a character string" + studysideMessage <- "ERROR: x.name must be specified as a character string" stop(studysideMessage, call. = FALSE) - } + } - if(!is.numeric(x)&&!is.integer(x)&&!is.character(x)&&!is.matrix(x)){ - studysideMessage<-"ERROR: for ds.asLogical function, x.name must specify an input object of class numeric, integer, character or matrix" - stop(studysideMessage, call. = FALSE) + if(!is.numeric(x) && !is.integer(x) && !is.character(x) && !is.matrix(x)){ + studysideMessage <- "ERROR: for ds.asLogical function, x.name must specify an input object of class numeric, integer, character or matrix" + stop(studysideMessage, call. = FALSE) } output <- as.logical(x) return(output) } -#ASSIGN FUNCTION +# ASSIGN FUNCTION # asLogicalDS diff --git a/R/aucDS.R b/R/aucDS.R index 6afda830..02d7f638 100644 --- a/R/aucDS.R +++ b/R/aucDS.R @@ -31,6 +31,6 @@ aucDS <- function(pred=pred, y=y){ q2 <- 2*AUC^2/(1+AUC)-AUC^2 se <- sqrt((q0+(n0-1)*q1+(n1-1)*q2)/(n0*n1)) - return(list(AUC=AUC,se=se)) + return(list(AUC=AUC, se=se)) } \ No newline at end of file diff --git a/R/minMaxRandDS.R b/R/minMaxRandDS.R index fbc452e6..36dc40ca 100644 --- a/R/minMaxRandDS.R +++ b/R/minMaxRandDS.R @@ -1,3 +1,4 @@ +#' #' @title Secure ranking of "V2BR" (vector to be ranked) across all sources #' @description Creates a minimum value that is more negative, and less positive #' 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) return(rand.min.max) } -#AGGREGATE +# AGGREGATE # minMaxRandDS - - - - diff --git a/R/subsetDS.R b/R/subsetDS.R deleted file mode 100644 index 3760902a..00000000 --- a/R/subsetDS.R +++ /dev/null @@ -1,134 +0,0 @@ -#' -#' @title Generates a valid subset of a table or a vector -#' @description The function uses the R classical subsetting with squared brackets '[]' and allows also to -#' subset using a logical oprator and a threshold. The object to subset from must be a vector (factor, numeric -#' or charcater) or a table (data.frame or matrix). -#' @details If the input data is a table: The user specifies the rows and/or columns to include in the subset if the input -#' object is a table; the columns can be refered to by their names. The name of a vector (i.e. a variable) can also be provided -#' with a logical operator and a threshold (see example 3). -#' If the input data is a vector: when the parameters 'rows', 'logical' and 'threshold' are all provided the last two are ignored ( -#' 'rows' has precedence over the other two parameters then). -#' If the requested subset is not valid (i.e. contains less than the allowed -#' number of observations), the subset is not generated, rather a table or a vector of missing values is generated to allow -#' for any subsequent process using the output of the function to proceed after informing the user via a message. -#' @param dt a string character, the name of the dataframe or the factor vector and the range of the subset. -#' @param complt a boolean that tells if the subset to subset should include only complete cases -#' @param rs a vector of two integers that give the range of rows de extract. -#' @param cs a vector of two integers or one or more characters; the indices of the columns to extract or the names of the columns (i.e. -#' names of the variables to extract). -#' @param lg a character, the logical parameter to use if the user wishes to subset a vector using a logical -#' operator. This parameter is ignored if the input data is not a vector. -#' @param th a numeric, the threshold to use in conjunction with the logical parameter. This parameter is ignored -#' if the input data is not a vector. -#' @param varname a character, if the input data is a table, if this parameter is provided along with the 'logical' and 'threshold' -#' parameters, a subtable is based the threshold applied to the speicified variable. This parameter is however ignored if the parameter -#' 'rows' and/or 'cols' are provided. -#' @return a subset of the vector, matric or dataframe as specified is stored on the server side -#' @author Gaye, A. -#' @export -#' -subsetDS <- function(dt=NULL, complt=NULL, rs=NULL, cs=NULL, lg=NULL, th=NULL, varname=NULL){ - - # Check Permissive Privacy Control Level. - dsBase::checkPermissivePrivacyControlLevel(c('permissive', 'banana')) - - # this filter sets the minimum number of observations that are allowed - - ############################################################# - # MODULE 1: CAPTURE THE nfilter SETTINGS - thr <- dsBase::listDisclosureSettingsDS() - nfilter.tab <- as.numeric(thr$nfilter.tab) - #nfilter.glm <- as.numeric(thr$nfilter.glm) - #nfilter.subset <- as.numeric(thr$nfilter.subset) - #nfilter.string <- as.numeric(thr$nfilter.string) - ############################################################# - - # the logical operators are given as integers change them into characters - if(!(is.null(lg))){ - if(lg == 1){lg <- ">"} - if(lg == 2){lg <- ">="} - if(lg == 3){lg <- "<"} - if(lg == 4){lg <- "<="} - if(lg == 5){lg <- "=="} - if(lg == 6){lg <- "!="} - } - - # evaluate the input data object - D <- eval(parse(text=dt), envir = parent.frame()) - - # if 'complt' is set to TRUE, get continue with a dataset with complete cases only - if(complt){ - cc <- stats::complete.cases(D) - xx <- which(cc == TRUE) - Dtemp <- D - if(is.vector(D) | is.factor(D)){ - D <- Dtemp[xx] - }else{ - D <- Dtemp[xx,] - } - } - - # carry out the subsetting - if(is.vector(D) | is.factor(D)){ # if the input data is a vector - - if(is.null(rs)){ - if(is.null(lg) | is.null(th)){ - subvect <- D - }else{ - exprs1 <- paste0("D[which(D", lg, th, ")]") - subvect <- eval(parse(text=exprs1)) - } - }else{ - subvect <- D[rs] - } - - if(length(subvect) < nfilter.tab){ - if(length(subvect) == 0){ - output <- D[-c(1:length(D))] - }else{ - temp1 <- subvect - temp1[1:length(temp1)] <- NA - output <- temp1 - } - }else{ - output <- subvect - } - }else{ # if the input data is a table - - if(!(is.null(rs)) | !(is.null(cs))){ - if(!(is.null(rs)) & !(is.null(cs))){ - subtable <- D[rs, cs] - }else{ - if(is.null(cs)){ - cs <- c(1:dim(D)[2]) - } - if(is.null(rs)){ - rs <- c(1:dim(D)[1]) - } - subtable <- D[rs,cs] - } - }else{ - if(is.null(varname)){ - subtable <- D - }else{ - idx <- which(colnames(D) == varname) - exprs2 <- paste0('D[which(D[,',idx,']', lg, th, '),]') - subtable <- eval(parse(text=exprs2)) - } - } - - if((dim(subtable)[1]) < nfilter.tab){ - if((dim(subtable)[1]) == 0){ - output <- D[-c(1:dim(D)[1]),] - }else{ - subD <- subtable - subD[] <- NA - output <- subD - } - }else{ - output <- subtable - } - } - - return(output) -} diff --git a/R/tableDS.R b/R/tableDS.R index c9e9d621..0ee91817 100644 --- a/R/tableDS.R +++ b/R/tableDS.R @@ -1,3 +1,4 @@ +#' #' @title tableDS is the first of two serverside aggregate functions #' called by ds.table #' @description creates 1-dimensional, 2-dimensional and 3-dimensional @@ -34,153 +35,118 @@ #' @return For information see help for \code{ds.table} #' @author Paul Burton for DataSHIELD Development Team, 13/11/2019 #' @export -tableDS<-function(rvar.transmit, cvar.transmit, stvar.transmit, rvar.all.unique.levels.transmit, cvar.all.unique.levels.transmit, - stvar.all.unique.levels.transmit, exclude.transmit, useNA.transmit, force.nfilter.transmit){ - - -######################################################################### -# DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS # -thr<-dsBase::listDisclosureSettingsDS() # -nfilter.tab<-as.numeric(thr$nfilter.tab) # -#nfilter.glm<-as.numeric(thr$nfilter.glm) # -#nfilter.subset<-as.numeric(thr$nfilter.subset) # -#nfilter.string<-as.numeric(thr$nfilter.string) # -#nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) # -#nfilter.kNN<-as.numeric(thr$nfilter.kNN) # -#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) # -######################################################################### - -#Force higher value of nfilter - - -if(!is.null(force.nfilter.transmit)) -{ -force.nfilter.active<-eval(parse(text=force.nfilter.transmit), envir = parent.frame()) - - if(force.nfilter.active= to nfilter.tab i.e.",nfilter.tab) - stop(return.message, call. = FALSE) - } -} -else -{ -force.nfilter.active<-NULL -} - -if(!is.null(force.nfilter.active)&&!is.na(force.nfilter.active)&&force.nfilter.active>nfilter.tab) -{ -nfilter.tab<-force.nfilter.active -} - +#' +tableDS <- function(rvar.transmit, cvar.transmit, stvar.transmit, rvar.all.unique.levels.transmit, + cvar.all.unique.levels.transmit, stvar.all.unique.levels.transmit, exclude.transmit, + useNA.transmit, force.nfilter.transmit){ + + # DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS + thr <- dsBase::listDisclosureSettingsDS() + nfilter.tab <- as.numeric(thr$nfilter.tab) + + # Force higher value of nfilter + if(!is.null(force.nfilter.transmit)){ + force.nfilter.active <- eval(parse(text=force.nfilter.transmit), envir = parent.frame()) + if(force.nfilter.active < nfilter.tab){ + return.message <- paste0("Failed: if force.nfilter is non-null it must be >= to nfilter.tab i.e.", + nfilter.tab) + stop(return.message, call. = FALSE) + } + }else{ + force.nfilter.active <- NULL + } + if(!is.null(force.nfilter.active) && !is.na(force.nfilter.active) && force.nfilter.active>nfilter.tab){ + nfilter.tab <- force.nfilter.active + } -#Activate via eval when needed -#rvar - rvar<-eval(parse(text=rvar.transmit), envir = parent.frame()) - if(!is.factor(rvar)) - { - rvar.all.unique.levels <- unlist(strsplit(rvar.all.unique.levels.transmit,split=",")) - rvar<-factor(as.factor(rvar), levels=rvar.all.unique.levels) + # Activate via eval when needed + + # rvar + rvar <- eval(parse(text=rvar.transmit), envir = parent.frame()) + if(!is.factor(rvar)){ + rvar.all.unique.levels <- unlist(strsplit(rvar.all.unique.levels.transmit, split=",")) + rvar <- factor(as.factor(rvar), levels=rvar.all.unique.levels) }else{ - rvar.all.unique.levels <- unlist(strsplit(rvar.all.unique.levels.transmit,split=",")) - rvar<-factor(rvar, levels=rvar.all.unique.levels) + rvar.all.unique.levels <- unlist(strsplit(rvar.all.unique.levels.transmit, split=",")) + rvar <- factor(rvar, levels=rvar.all.unique.levels) } -#cvar - if(!is.null(cvar.transmit)) -{ - cvar<-eval(parse(text=cvar.transmit), envir = parent.frame()) - if(!is.factor(cvar)) - { + + # cvar + if(!is.null(cvar.transmit)){ + cvar <- eval(parse(text=cvar.transmit), envir = parent.frame()) + if(!is.factor(cvar)){ cvar.all.unique.levels <- unlist(strsplit(cvar.all.unique.levels.transmit,split=",")) - cvar<-factor(as.factor(cvar), levels=cvar.all.unique.levels) + cvar <- factor(as.factor(cvar), levels=cvar.all.unique.levels) }else{ cvar.all.unique.levels <- unlist(strsplit(cvar.all.unique.levels.transmit,split=",")) - cvar<-factor(cvar, levels=cvar.all.unique.levels) + cvar <- factor(cvar, levels=cvar.all.unique.levels) } - -} -else -{ -cvar<-NULL -} -#stvar -if(!is.null(stvar.transmit)) -{ - stvar<-eval(parse(text=stvar.transmit), envir = parent.frame()) - if(!is.factor(stvar)) - { - stvar.all.unique.levels<- unlist(strsplit(stvar.all.unique.levels.transmit,split=",")) - stvar<-factor(as.factor(stvar), levels=stvar.all.unique.levels) }else{ - stvar.all.unique.levels<- unlist(strsplit(stvar.all.unique.levels.transmit,split=",")) - stvar<-factor(stvar, levels=stvar.all.unique.levels) + cvar <- NULL + } + + # stvar + if(!is.null(stvar.transmit)){ + stvar <- eval(parse(text=stvar.transmit), envir = parent.frame()) + if(!is.factor(stvar)){ + stvar.all.unique.levels <- unlist(strsplit(stvar.all.unique.levels.transmit,split=",")) + stvar <- factor(as.factor(stvar), levels=stvar.all.unique.levels) + }else{ + stvar.all.unique.levels <- unlist(strsplit(stvar.all.unique.levels.transmit,split=",")) + stvar <- factor(stvar, levels=stvar.all.unique.levels) + } + }else{ + stvar <- NULL } -} -else -{ -stvar<-NULL -} - -#exclude -if(!is.null(exclude.transmit)) -{ -exclude.text<-strsplit(exclude.transmit, split=",") -exclude<-eval(parse(text=exclude.text), envir = parent.frame()) -} -else -{ -exclude<-NULL -} - -if(!is.null(rvar)&&!is.null(cvar)&&!is.null(stvar)) -{ -#Check cell counts valid without NAs or NaNs -counts.valid<-TRUE -test.outobj<-table(rvar,cvar,stvar,exclude="NaN",useNA="no") - -numcells<-length(test.outobj) - for (cell in 1:numcells) - { - if(test.outobj[cell]>0&&test.outobj[cell]0 && test.outobj[cell]0&&test.outobj[cell]0 && test.outobj[cell] -Generates a valid subset of a table or a vector — subsetDS • dsBase - - -
-
- - - -
-
- - -
-

The function uses the R classical subsetting with squared brackets '[]' and allows also to -subset using a logical oprator and a threshold. The object to subset from must be a vector (factor, numeric -or charcater) or a table (data.frame or matrix).

-
- -
-
subsetDS(
-  dt = NULL,
-  complt = NULL,
-  rs = NULL,
-  cs = NULL,
-  lg = NULL,
-  th = NULL,
-  varname = NULL
-)
-
- -
-

Arguments

- - -
dt
-

a string character, the name of the dataframe or the factor vector and the range of the subset.

- - -
complt
-

a boolean that tells if the subset to subset should include only complete cases

- - -
rs
-

a vector of two integers that give the range of rows de extract.

- - -
cs
-

a vector of two integers or one or more characters; the indices of the columns to extract or the names of the columns (i.e. -names of the variables to extract).

- - -
lg
-

a character, the logical parameter to use if the user wishes to subset a vector using a logical -operator. This parameter is ignored if the input data is not a vector.

- - -
th
-

a numeric, the threshold to use in conjunction with the logical parameter. This parameter is ignored -if the input data is not a vector.

- - -
varname
-

a character, if the input data is a table, if this parameter is provided along with the 'logical' and 'threshold' -parameters, a subtable is based the threshold applied to the speicified variable. This parameter is however ignored if the parameter -'rows' and/or 'cols' are provided.

- -
-
-

Value

-

a subset of the vector, matric or dataframe as specified is stored on the server side

-
-
-

Details

-

If the input data is a table: The user specifies the rows and/or columns to include in the subset if the input -object is a table; the columns can be refered to by their names. The name of a vector (i.e. a variable) can also be provided -with a logical operator and a threshold (see example 3). -If the input data is a vector: when the parameters 'rows', 'logical' and 'threshold' are all provided the last two are ignored ( -'rows' has precedence over the other two parameters then). -If the requested subset is not valid (i.e. contains less than the allowed -number of observations), the subset is not generated, rather a table or a vector of missing values is generated to allow -for any subsequent process using the output of the function to proceed after informing the user via a message.

-
-
-

Author

-

Gaye, A.

-
- -
- -
- - -
- -
-

Site built with pkgdown 2.1.1.

-
- -
- - - - - - - - diff --git a/man/subsetDS.Rd b/man/subsetDS.Rd deleted file mode 100644 index f25696af..00000000 --- a/man/subsetDS.Rd +++ /dev/null @@ -1,57 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/subsetDS.R -\name{subsetDS} -\alias{subsetDS} -\title{Generates a valid subset of a table or a vector} -\usage{ -subsetDS( - dt = NULL, - complt = NULL, - rs = NULL, - cs = NULL, - lg = NULL, - th = NULL, - varname = NULL -) -} -\arguments{ -\item{dt}{a string character, the name of the dataframe or the factor vector and the range of the subset.} - -\item{complt}{a boolean that tells if the subset to subset should include only complete cases} - -\item{rs}{a vector of two integers that give the range of rows de extract.} - -\item{cs}{a vector of two integers or one or more characters; the indices of the columns to extract or the names of the columns (i.e. -names of the variables to extract).} - -\item{lg}{a character, the logical parameter to use if the user wishes to subset a vector using a logical -operator. This parameter is ignored if the input data is not a vector.} - -\item{th}{a numeric, the threshold to use in conjunction with the logical parameter. This parameter is ignored -if the input data is not a vector.} - -\item{varname}{a character, if the input data is a table, if this parameter is provided along with the 'logical' and 'threshold' -parameters, a subtable is based the threshold applied to the speicified variable. This parameter is however ignored if the parameter -'rows' and/or 'cols' are provided.} -} -\value{ -a subset of the vector, matric or dataframe as specified is stored on the server side -} -\description{ -The function uses the R classical subsetting with squared brackets '[]' and allows also to -subset using a logical oprator and a threshold. The object to subset from must be a vector (factor, numeric -or charcater) or a table (data.frame or matrix). -} -\details{ -If the input data is a table: The user specifies the rows and/or columns to include in the subset if the input -object is a table; the columns can be refered to by their names. The name of a vector (i.e. a variable) can also be provided -with a logical operator and a threshold (see example 3). -If the input data is a vector: when the parameters 'rows', 'logical' and 'threshold' are all provided the last two are ignored ( -'rows' has precedence over the other two parameters then). -If the requested subset is not valid (i.e. contains less than the allowed -number of observations), the subset is not generated, rather a table or a vector of missing values is generated to allow -for any subsequent process using the output of the function to proceed after informing the user via a message. -} -\author{ -Gaye, A. -} diff --git a/tests/testthat/test-smk-subsetDS.R b/tests/testthat/test-smk-subsetDS.R deleted file mode 100644 index f34119c4..00000000 --- a/tests/testthat/test-smk-subsetDS.R +++ /dev/null @@ -1,125 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2019-2022 University of Newcastle upon Tyne. All rights reserved. -# -# This program and the accompanying materials -# are made available under the terms of the GNU Public License v3.0. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -#------------------------------------------------------------------------------- - -# -# Set up -# - -context("subsetDS::smk::setup") - -set.standard.disclosure.settings() - -# -# Tests -# - -context("subsetDS::smk") -test_that("simple subsetDS, no NAs", { - data <- data.frame(v1 = c(0, 0, 1, 1, 2, 2, 3, 3, 4, 4), v2 = c(4.0, 0.0, 3.0, 1.0, 2.0, 2.0, 1.0, 3.0, 0.0, 4.0)) - complt <- FALSE - rs <- NULL - cs <- NULL - lg <- 2 - th <- 2 - varname <- "v1" - - res <- subsetDS("data", complt, rs, cs, lg, th, varname) - - expect_equal(class(res), "data.frame") - expect_length(res, 2) - - expect_equal(class(res$v1), "numeric") - expect_length(res$v1, 6) - expect_equal(res$v1[1], 2) - expect_equal(res$v1[2], 2) - expect_equal(res$v1[3], 3) - expect_equal(res$v1[4], 3) - expect_equal(res$v1[5], 4) - expect_equal(res$v1[6], 4) - - expect_equal(class(res$v2), "numeric") - expect_length(res$v2, 6) - expect_equal(res$v2[1], 2.0) - expect_equal(res$v2[2], 2.0) - expect_equal(res$v2[3], 1.0) - expect_equal(res$v2[4], 3.0) - expect_equal(res$v2[5], 0.0) - expect_equal(res$v2[6], 4.0) -}) - -test_that("simple subsetDS, NAs, complete.case FALSE", { - data <- data.frame(v1 = c(0, 0, 1, 1, 2, 2, 3, 3, 4, 4), v2 = c(4.0, 0.0, 3.0, 1.0, 2.0, 2.0, 1.0, NA, NA, 4.0)) - complt <- FALSE - rs <- NULL - cs <- NULL - lg <- 2 - th <- 2 - varname <- "v1" - - res <- subsetDS("data", complt, rs, cs, lg, th, varname) - - expect_equal(class(res), "data.frame") - expect_length(res, 2) - - expect_equal(class(res$v1), "numeric") - expect_length(res$v1, 6) - expect_equal(res$v1[1], 2) - expect_equal(res$v1[2], 2) - expect_equal(res$v1[3], 3) - expect_equal(res$v1[4], 3) - expect_equal(res$v1[5], 4) - expect_equal(res$v1[6], 4) - - expect_equal(class(res$v2), "numeric") - expect_length(res$v2, 6) - expect_equal(res$v2[1], 2.0) - expect_equal(res$v2[2], 2.0) - expect_equal(res$v2[3], 1.0) - expect_true(is.na(res$v2[4])) - expect_true(is.na(res$v2[5])) - expect_equal(res$v2[6], 4.0) -}) - -test_that("simple subsetDS, NAs, complete.case TRUE", { - data <- data.frame(v1 = c(0, 0, 1, 1, 2, 2, 3, 3, 4, 4), v2 = c(4.0, 0.0, 3.0, 1.0, 2.0, 2.0, 1.0, NA, NA, 4.0)) - complt <- TRUE - rs <- NULL - cs <- NULL - lg <- 2 - th <- 2 - varname <- "v1" - - res <- subsetDS("data", complt, rs, cs, lg, th, varname) - - expect_equal(class(res), "data.frame") - expect_length(res, 2) - - expect_equal(class(res$v1), "numeric") - expect_length(res$v1, 4) - expect_equal(res$v1[1], 2) - expect_equal(res$v1[2], 2) - expect_equal(res$v1[3], 3) - expect_equal(res$v1[4], 4) - - expect_equal(class(res$v2), "numeric") - expect_length(res$v2, 4) - expect_equal(res$v2[1], 2.0) - expect_equal(res$v2[2], 2.0) - expect_equal(res$v2[3], 1.0) - expect_equal(res$v2[4], 4.0) -}) - -# -# Done -# - -context("subsetDS::smk::shutdown") - -context("subsetDS::smk::done") From 675cc565672b91c2e4120538e179c608af96ebd7 Mon Sep 17 00:00:00 2001 From: davraam Date: Fri, 24 Jan 2025 11:27:21 +0200 Subject: [PATCH 08/24] remove deprecated ds.subset and ds.subsetByClass --- DESCRIPTION | 5 +- NAMESPACE | 1 - R/subsetByClassDS.R | 79 ---------------- R/subsetByClassHelper1.R | 40 -------- R/subsetByClassHelper2.R | 63 ------------- R/subsetByClassHelper3.R | 58 ------------ docs/reference/subsetByClassDS.html | 107 ---------------------- docs/reference/subsetByClassHelper1.html | 102 --------------------- docs/reference/subsetByClassHelper2.html | 107 ---------------------- docs/reference/subsetByClassHelper3.html | 105 --------------------- man/subsetByClassDS.Rd | 32 ------- man/subsetByClassHelper1.Rd | 28 ------ man/subsetByClassHelper2.Rd | 33 ------- man/subsetByClassHelper3.Rd | 31 ------- tests/testthat/test-smk-subsetByClassDS.R | 87 ------------------ 15 files changed, 1 insertion(+), 877 deletions(-) delete mode 100644 R/subsetByClassDS.R delete mode 100644 R/subsetByClassHelper1.R delete mode 100644 R/subsetByClassHelper2.R delete mode 100644 R/subsetByClassHelper3.R delete mode 100644 docs/reference/subsetByClassDS.html delete mode 100644 docs/reference/subsetByClassHelper1.html delete mode 100644 docs/reference/subsetByClassHelper2.html delete mode 100644 docs/reference/subsetByClassHelper3.html delete mode 100644 man/subsetByClassDS.Rd delete mode 100644 man/subsetByClassHelper1.Rd delete mode 100644 man/subsetByClassHelper2.Rd delete mode 100644 man/subsetByClassHelper3.Rd delete mode 100644 tests/testthat/test-smk-subsetByClassDS.R diff --git a/DESCRIPTION b/DESCRIPTION index d92b0b05..74d5ea70 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,9 +20,7 @@ Imports: mice, childsds, purrr, - tibble, - tidyselect, - tidytable, + tibble, tidyverse Suggests: testthat @@ -163,7 +161,6 @@ AssignMethods: sampleDS, seqDS, sqrtDS, - subsetByClassDS, tableDS.assign, tapplyDS.assign, uniqueDS, diff --git a/NAMESPACE b/NAMESPACE index 113ffe4b..e596d416 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -124,7 +124,6 @@ export(setSeedDS) export(skewnessDS1) export(skewnessDS2) export(sqrtDS) -export(subsetByClassDS) export(table1DDS) export(table2DDS) export(tableDS) diff --git a/R/subsetByClassDS.R b/R/subsetByClassDS.R deleted file mode 100644 index f213bb4d..00000000 --- a/R/subsetByClassDS.R +++ /dev/null @@ -1,79 +0,0 @@ -#' -#' @title Breaks down a dataframe or a factor into its sub-classes -#' @description The function takes a categorical vector or dataframe as input and generates subset(s) -#' vectors or dataframes for each category. Subsets are considered invalid if they hold between 1 and -#' 4 observations. -#' @details If the input data object is a dataframe it is possible to specify the variables -#' to subset on. If a subset is not 'valid' all its the values are reported as missing (i.e. NA), -#' the name of the subsets is labelled as '_INVALID'. If no variables are specified to subset on, -#' the dataframe will be subset on each of its factor variables. -#' And if none of the columns holds a factor variable a message is issued as output. A message is also -#' issued as output if the input vector is not of type factor. -#' @param data a string character, the name of the dataframe or the factor vector -#' @param variables a vector of string characters, the names of the the variables to subset on. -#' @return a list which contains the subsetted datasets -#' @author Gaye, A. -#' @export -#' -subsetByClassDS <- function(data=NULL, variables=NULL){ - - # Check Permissive Privacy Control Level. - dsBase::checkPermissivePrivacyControlLevel(c('permissive', 'banana')) - - # this filter sets the minimum number of observations that are allowed - - ############################################################# - # MODULE 1: CAPTURE THE nfilter SETTINGS - thr <- dsBase::listDisclosureSettingsDS() - #nfilter.tab <- as.numeric(thr$nfilter.tab) - #nfilter.glm <- as.numeric(thr$nfilter.glm) - nfilter.subset <- as.numeric(thr$nfilter.subset) - #nfilter.string <- as.numeric(thr$nfilter.string) - ############################################################# - - # evaluate the string passed on to the function as an object - input <- eval(parse(text=data), envir = parent.frame()) - - # subsetting is carried out only of the input is of type factor or data.frame - if(is.factor(input)){ - # call the internal function that generates subsets if the input is a factor variable - Dname <- extract(data)[[2]] - output <- subsetByClassHelper1(input, Dname, nfilter.subset) - }else{ - # get the names of the variables on the dataset - varnames <- colnames(input) - - # set the number of loops depending on the number of variables specified - # if no variable was specified then loop through all the variables - if(is.null(variables)){ - loop <- c(1:dim(input)[2]) - }else{ - # if the user specified variables to subset on check if those are in the dataset to subset from, - # if none of the variables is on the dataset record a message to inform the user - indx <- which(varnames %in% variables) - - if(length(indx) > 1){ - loop <- indx - }else{ - loop <- 1 - } - } - - # loop through the variables and make a subset dataframe for each level - # of each factor variable and keep the generated subset dataframes in a list - if(length(loop) > 1){ - # call the function that gets the subsets if the user specified non or more than 1 variable - out.temp <- subsetByClassHelper2(input,loop,nfilter.subset) - subsets <- out.temp[[1]] - nonfactorvars <- out.temp[[2]] - }else{ - # call the function that gets the subsets if the user specified only one variable to subset by - out.temp <- subsetByClassHelper3(input,indx,nfilter.subset) - subsets <- out.temp[[1]] - nonfactorvars <- out.temp[[2]] - } - output <- subsets - } - - return(output) -} diff --git a/R/subsetByClassHelper1.R b/R/subsetByClassHelper1.R deleted file mode 100644 index 1e5a9065..00000000 --- a/R/subsetByClassHelper1.R +++ /dev/null @@ -1,40 +0,0 @@ -#' -#' @title generates subsets vectors from a factor vector -#' @description This is an internal function called by the function 'subsetByClassDS'. -#' @details The function generates subsets if the input of 'subsetByClassDS' is a factor vector. -#' @param xvect a vector of type factor. -#' @param xname the name of the vector. -#' @param filter the minimum number observation (i.e. rows) that are allowed. -#' @return a list which contains the subsets. -#' @keywords internal -#' @author Gaye, A. -#' -subsetByClassHelper1 <- function(xvect=NULL, xname=NULL, filter=NULL){ - vectname <- xname - subsets <- list() - names.of.subsets <- c() - categories <- levels(xvect) - for(i in 1:length(categories)){ - indices <- which(xvect == as.numeric(categories[i])) - if(!(length(indices) < filter)){ - subsets[[i]] <- xvect[indices] - name.of.subD <- paste(vectname,".level_", categories[i], sep="") - names.of.subsets <- append(names.of.subsets, name.of.subD) - }else{ - # if any one category has between 0 and 'filter' observation turn subset content into missing values - if(length(indices) == 0){ - subsets[[i]] <- xvect[-c(1:length(xvect))] - name.of.subD <- paste(vectname,".level_", categories[i], "_EMPTY", sep="") - }else{ - temp1 <- xvect[indices] - temp1[1:length(temp1)] <- NA - subsets[[i]] <- temp1 - name.of.subD <- paste(vectname,".level_", categories[i], "_INVALID", sep="") - } - names.of.subsets <- append(names.of.subsets, name.of.subD) - } - names(subsets) <- names.of.subsets - output <- subsets - } - return(output) -} diff --git a/R/subsetByClassHelper2.R b/R/subsetByClassHelper2.R deleted file mode 100644 index a888030c..00000000 --- a/R/subsetByClassHelper2.R +++ /dev/null @@ -1,63 +0,0 @@ -#' -#' @title generates subset tables from a data frame -#' @description This is an internal function called by the function 'subsetByClassDS' -#' @details The function generates subsets if the input of 'subsetByClassDS' is a data frame -#' and if the number variables(columns) to subset by are greater than 1; i.e. this -#' function is called if the user specified more than one variable or no variable to subset by -#' (if no variables are specified the function 'subsetByClassDS' produces a subset for each category -#' in each variable). -#' @param df a data frame. -#' @param iter the indices of columns to loop trough. -#' @param filter the minimum number of observations (i.e. rows) that are allowed. -#' @return a list which contains the subsets, their names and an integer that indicates how many columns were -#' not factors. -#' @keywords internal -#' @author Gaye, A. -#' -subsetByClassHelper2 <- function(df=NULL, iter=NULL, filter=NULL){ - # various counters and temporary variables to hold info - subsets <- list() - names.of.subsets <- c() - count <- 0 - nonfactorvars <- 0 - ncols <- length(colnames(df)) - for(i in iter){ - var <- df[,i] - varname <- colnames(df)[i] - if(is.factor(var)){ - # get the levels - categories <- levels(var) - # loop through the levels and generate a dataset for each level - # if the number of observations for that level > 0 and < 'filter' - for(j in 1:length(categories)){ - indices <- which(var == as.numeric(categories[j])) - if(!(length(indices) < filter)){ - count <- count+1 - subD <- df[indices,] - subsets[[count]] <- subD - name.of.subD <- paste(varname,".level_", categories[j], sep="") - names.of.subsets <- append(names.of.subsets, name.of.subD) - }else{ - # if any one category has between 1 and 'filter' number of observation turn subset content into missing values - count <- count+1 - if(length(indices) == 0){ - subsets[[count]] <- df[-c(1:dim(df)[1]),] - name.of.subD <- paste(varname,".level_", categories[j], "_EMPTY",sep="") - }else{ - subD <- df[indices,] - subD[] <- NA - subsets[[count]] <- subD - name.of.subD <- paste(varname,".level_", categories[j], "_INVALID",sep="") - } - colnames(subsets[[count]]) <- colnames(df) - names.of.subsets <- append(names.of.subsets, name.of.subD) - } - } - names(subsets) <- names.of.subsets - }else{ - # if a variable is not a factor increment the below counter - nonfactorvars <- nonfactorvars + 1 - } - } - return(list(subsets, nonfactorvars)) -} \ No newline at end of file diff --git a/R/subsetByClassHelper3.R b/R/subsetByClassHelper3.R deleted file mode 100644 index c43962eb..00000000 --- a/R/subsetByClassHelper3.R +++ /dev/null @@ -1,58 +0,0 @@ -#' -#' @title generates subset tables from a data frame -#' @description This is an internal function called by the function 'subsetByClassDS' -#' @details The function generates subsets if the input of 'subsetByClassDS' is a data frame -#' and if the number of variables (columns) to subset by is 1; i.e. this -#' function is called if the user specified one variable to subset by. -#' @param df a data frame. -#' @param indx1 the column index of the variable specified by the user. -#' @param filter the minimum number of observations (i.e. rows) that are allowed. -#' @return a list which contains the subsets, their names and an integer that indicates if -#' the variable specified by user is a factor. -#' @keywords internal -#' @author Gaye, A. -#' -subsetByClassHelper3 <- function(df=NULL, indx1=NULL, filter=NULL){ - # various counters and temporary variables to hold info - subsets <- list() - names.of.subsets <- c() - count <- 0 - nonfactorvars <- 0 - ncols <- length(colnames(df)) - var <- df[,indx1] - varname <- colnames(df)[indx1] - if(is.factor(var)){ - # get the levels - categories <- levels(var) - # loop through the levels and generate a dataset for each level - # if the number of observations for that level > 0 and < 'filter' - for(j in 1:length(categories)){ - indices <- which(var == as.numeric(categories[j])) - if(!(length(indices) < filter)){ - count <- count+1 - subD <- df[indices,] - subsets[[count]] <- subD - name.of.subD <- paste(varname,".level_", categories[j], sep="") - names.of.subsets <- append(names.of.subsets, name.of.subD) - }else{ - # if any one category has between 1 and 'filter' number of observations turn subset content into missing values - count <- count+1 - if(length(indices) == 0){ - subsets[[count]] <- df[-c(1:dim(df)[1]),] - name.of.subD <- paste(varname,".level_", categories[j], "_EMPTY",sep="") - }else{ - subD <- df[indices,] - subD[] <- NA - subsets[[count]] <- subD - name.of.subD <- paste(varname,".level_", categories[j], "_INVALID",sep="") - } - colnames(subsets[[count]]) <- colnames(df) - names.of.subsets <- append(names.of.subsets, name.of.subD) - } - } - names(subsets) <- names.of.subsets - }else{ - nonfactorvars <- 1 - } - return(list(subsets, nonfactorvars)) -} \ No newline at end of file diff --git a/docs/reference/subsetByClassDS.html b/docs/reference/subsetByClassDS.html deleted file mode 100644 index 2ad6ec64..00000000 --- a/docs/reference/subsetByClassDS.html +++ /dev/null @@ -1,107 +0,0 @@ - -Breaks down a dataframe or a factor into its sub-classes — subsetByClassDS • dsBase - - -
-
- - - -
-
- - -
-

The function takes a categorical vector or dataframe as input and generates subset(s) -vectors or dataframes for each category. Subsets are considered invalid if they hold between 1 and -4 observations.

-
- -
-
subsetByClassDS(data = NULL, variables = NULL)
-
- -
-

Arguments

- - -
data
-

a string character, the name of the dataframe or the factor vector

- - -
variables
-

a vector of string characters, the names of the the variables to subset on.

- -
-
-

Value

-

a list which contains the subsetted datasets

-
-
-

Details

-

If the input data object is a dataframe it is possible to specify the variables -to subset on. If a subset is not 'valid' all its the values are reported as missing (i.e. NA), -the name of the subsets is labelled as '_INVALID'. If no variables are specified to subset on, -the dataframe will be subset on each of its factor variables. -And if none of the columns holds a factor variable a message is issued as output. A message is also -issued as output if the input vector is not of type factor.

-
-
-

Author

-

Gaye, A.

-
- -
- -
- - -
- -
-

Site built with pkgdown 2.1.1.

-
- -
- - - - - - - - diff --git a/docs/reference/subsetByClassHelper1.html b/docs/reference/subsetByClassHelper1.html deleted file mode 100644 index c2192267..00000000 --- a/docs/reference/subsetByClassHelper1.html +++ /dev/null @@ -1,102 +0,0 @@ - -generates subsets vectors from a factor vector — subsetByClassHelper1 • dsBase - - -
-
- - - -
-
- - -
-

This is an internal function called by the function 'subsetByClassDS'.

-
- -
-
subsetByClassHelper1(xvect = NULL, xname = NULL, filter = NULL)
-
- -
-

Arguments

- - -
xvect
-

a vector of type factor.

- - -
xname
-

the name of the vector.

- - -
filter
-

the minimum number observation (i.e. rows) that are allowed.

- -
-
-

Value

-

a list which contains the subsets.

-
-
-

Details

-

The function generates subsets if the input of 'subsetByClassDS' is a factor vector.

-
-
-

Author

-

Gaye, A.

-
- -
- -
- - -
- -
-

Site built with pkgdown 2.1.1.

-
- -
- - - - - - - - diff --git a/docs/reference/subsetByClassHelper2.html b/docs/reference/subsetByClassHelper2.html deleted file mode 100644 index 50766d5b..00000000 --- a/docs/reference/subsetByClassHelper2.html +++ /dev/null @@ -1,107 +0,0 @@ - -generates subset tables from a data frame — subsetByClassHelper2 • dsBase - - -
-
- - - -
-
- - -
-

This is an internal function called by the function 'subsetByClassDS'

-
- -
-
subsetByClassHelper2(df = NULL, iter = NULL, filter = NULL)
-
- -
-

Arguments

- - -
df
-

a data frame.

- - -
iter
-

the indices of columns to loop trough.

- - -
filter
-

the minimum number of observations (i.e. rows) that are allowed.

- -
-
-

Value

-

a list which contains the subsets, their names and an integer that indicates how many columns were -not factors.

-
-
-

Details

-

The function generates subsets if the input of 'subsetByClassDS' is a data frame -and if the number variables(columns) to subset by are greater than 1; i.e. this -function is called if the user specified more than one variable or no variable to subset by -(if no variables are specified the function 'subsetByClassDS' produces a subset for each category -in each variable).

-
-
-

Author

-

Gaye, A.

-
- -
- -
- - -
- -
-

Site built with pkgdown 2.1.1.

-
- -
- - - - - - - - diff --git a/docs/reference/subsetByClassHelper3.html b/docs/reference/subsetByClassHelper3.html deleted file mode 100644 index 0629b441..00000000 --- a/docs/reference/subsetByClassHelper3.html +++ /dev/null @@ -1,105 +0,0 @@ - -generates subset tables from a data frame — subsetByClassHelper3 • dsBase - - -
-
- - - -
-
- - -
-

This is an internal function called by the function 'subsetByClassDS'

-
- -
-
subsetByClassHelper3(df = NULL, indx1 = NULL, filter = NULL)
-
- -
-

Arguments

- - -
df
-

a data frame.

- - -
indx1
-

the column index of the variable specified by the user.

- - -
filter
-

the minimum number of observations (i.e. rows) that are allowed.

- -
-
-

Value

-

a list which contains the subsets, their names and an integer that indicates if -the variable specified by user is a factor.

-
-
-

Details

-

The function generates subsets if the input of 'subsetByClassDS' is a data frame -and if the number of variables (columns) to subset by is 1; i.e. this -function is called if the user specified one variable to subset by.

-
-
-

Author

-

Gaye, A.

-
- -
- -
- - -
- -
-

Site built with pkgdown 2.1.1.

-
- -
- - - - - - - - diff --git a/man/subsetByClassDS.Rd b/man/subsetByClassDS.Rd deleted file mode 100644 index c56e6537..00000000 --- a/man/subsetByClassDS.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/subsetByClassDS.R -\name{subsetByClassDS} -\alias{subsetByClassDS} -\title{Breaks down a dataframe or a factor into its sub-classes} -\usage{ -subsetByClassDS(data = NULL, variables = NULL) -} -\arguments{ -\item{data}{a string character, the name of the dataframe or the factor vector} - -\item{variables}{a vector of string characters, the names of the the variables to subset on.} -} -\value{ -a list which contains the subsetted datasets -} -\description{ -The function takes a categorical vector or dataframe as input and generates subset(s) -vectors or dataframes for each category. Subsets are considered invalid if they hold between 1 and -4 observations. -} -\details{ -If the input data object is a dataframe it is possible to specify the variables -to subset on. If a subset is not 'valid' all its the values are reported as missing (i.e. NA), -the name of the subsets is labelled as '_INVALID'. If no variables are specified to subset on, -the dataframe will be subset on each of its factor variables. -And if none of the columns holds a factor variable a message is issued as output. A message is also -issued as output if the input vector is not of type factor. -} -\author{ -Gaye, A. -} diff --git a/man/subsetByClassHelper1.Rd b/man/subsetByClassHelper1.Rd deleted file mode 100644 index 8306ab3f..00000000 --- a/man/subsetByClassHelper1.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/subsetByClassHelper1.R -\name{subsetByClassHelper1} -\alias{subsetByClassHelper1} -\title{generates subsets vectors from a factor vector} -\usage{ -subsetByClassHelper1(xvect = NULL, xname = NULL, filter = NULL) -} -\arguments{ -\item{xvect}{a vector of type factor.} - -\item{xname}{the name of the vector.} - -\item{filter}{the minimum number observation (i.e. rows) that are allowed.} -} -\value{ -a list which contains the subsets. -} -\description{ -This is an internal function called by the function 'subsetByClassDS'. -} -\details{ -The function generates subsets if the input of 'subsetByClassDS' is a factor vector. -} -\author{ -Gaye, A. -} -\keyword{internal} diff --git a/man/subsetByClassHelper2.Rd b/man/subsetByClassHelper2.Rd deleted file mode 100644 index e1ea3c8f..00000000 --- a/man/subsetByClassHelper2.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/subsetByClassHelper2.R -\name{subsetByClassHelper2} -\alias{subsetByClassHelper2} -\title{generates subset tables from a data frame} -\usage{ -subsetByClassHelper2(df = NULL, iter = NULL, filter = NULL) -} -\arguments{ -\item{df}{a data frame.} - -\item{iter}{the indices of columns to loop trough.} - -\item{filter}{the minimum number of observations (i.e. rows) that are allowed.} -} -\value{ -a list which contains the subsets, their names and an integer that indicates how many columns were -not factors. -} -\description{ -This is an internal function called by the function 'subsetByClassDS' -} -\details{ -The function generates subsets if the input of 'subsetByClassDS' is a data frame -and if the number variables(columns) to subset by are greater than 1; i.e. this -function is called if the user specified more than one variable or no variable to subset by -(if no variables are specified the function 'subsetByClassDS' produces a subset for each category -in each variable). -} -\author{ -Gaye, A. -} -\keyword{internal} diff --git a/man/subsetByClassHelper3.Rd b/man/subsetByClassHelper3.Rd deleted file mode 100644 index bd1c3293..00000000 --- a/man/subsetByClassHelper3.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/subsetByClassHelper3.R -\name{subsetByClassHelper3} -\alias{subsetByClassHelper3} -\title{generates subset tables from a data frame} -\usage{ -subsetByClassHelper3(df = NULL, indx1 = NULL, filter = NULL) -} -\arguments{ -\item{df}{a data frame.} - -\item{indx1}{the column index of the variable specified by the user.} - -\item{filter}{the minimum number of observations (i.e. rows) that are allowed.} -} -\value{ -a list which contains the subsets, their names and an integer that indicates if -the variable specified by user is a factor. -} -\description{ -This is an internal function called by the function 'subsetByClassDS' -} -\details{ -The function generates subsets if the input of 'subsetByClassDS' is a data frame -and if the number of variables (columns) to subset by is 1; i.e. this -function is called if the user specified one variable to subset by. -} -\author{ -Gaye, A. -} -\keyword{internal} diff --git a/tests/testthat/test-smk-subsetByClassDS.R b/tests/testthat/test-smk-subsetByClassDS.R deleted file mode 100644 index 8de5114b..00000000 --- a/tests/testthat/test-smk-subsetByClassDS.R +++ /dev/null @@ -1,87 +0,0 @@ -#------------------------------------------------------------------------------- -# Copyright (c) 2019-2022 University of Newcastle upon Tyne. All rights reserved. -# -# This program and the accompanying materials -# are made available under the terms of the GNU Public License v3.0. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -#------------------------------------------------------------------------------- - -# -# Set up -# - -context("subsetByClassDS::smk::setup") - -set.standard.disclosure.settings() - -# -# Tests -# - -context("subsetByClassDS::smk") -test_that("simple subsetByClassDS, data.frame, unspecified variables", { - data <- data.frame(v1 = factor(c(0, 0, 0, 1, 1, 1, 2, 1, 2, 2)), v2 = c(4.0, 0.0, 3.0, 1.0, 2.0, 2.0, 1.0, 3.0, 0.0, 4.0), v3 = c(1:10), v4 = c(1:10)) - variables <- NULL - - res <- subsetByClassDS("data", variables) - - expect_equal(class(res), "list") - expect_length(res, 3) - - expect_equal(class(res$v1.level_0), "data.frame") - expect_length(res$v1.level_0, 4) - - expect_equal(class(res$v1.level_1), "data.frame") - expect_length(res$v1.level_1, 4) - - expect_equal(class(res$v1.level_2), "data.frame") - expect_length(res$v1.level_2, 4) -}) - -test_that("simple subsetByClassDS, data.frame, specified variables", { - data <- data.frame(v1 = factor(c(0, 0, 0, 1, 1, 1, 2, 1, 2, 2)), v2 = c(4.0, 0.0, 3.0, 1.0, 2.0, 2.0, 1.0, 3.0, 0.0, 4.0), v3 = c(1:10), v4 = c(1:10)) - variables <- c("v1") - - res <- subsetByClassDS("data", variables) - - expect_equal(class(res), "list") - expect_length(res, 3) - - expect_equal(class(res$v1.level_0), "data.frame") - expect_length(res$v1.level_0, 4) - - expect_equal(class(res$v1.level_1), "data.frame") - expect_length(res$v1.level_1, 4) - - expect_equal(class(res$v1.level_2), "data.frame") - expect_length(res$v1.level_2, 4) -}) - -test_that("simple subsetByClassDS, factor vector, specified variables", { - data <- factor(c(0, 0, 0, 1, 1, 1, 2, 1, 2, 2)) - variables <- NULL - - res <- subsetByClassDS("data", variables) - - expect_equal(class(res), "list") - expect_length(res, 3) - - expect_equal(class(res$data.level_0), "factor") - expect_length(res$data.level_0, 3) - - expect_equal(class(res$data.level_1), "factor") - expect_length(res$data.level_1, 4) - - expect_equal(class(res$data.level_2), "factor") - expect_length(res$data.level_2, 3) -}) - -# -# Done -# - -context("subsetByClassDS::smk::shutdown") - -context("subsetByClassDS::smk::done") From a7fccbe37a385525d444df6ca8416bc1ad8a2434 Mon Sep 17 00:00:00 2001 From: Tim Cadman <41470917+timcadman@users.noreply.github.com> Date: Mon, 10 Feb 2025 13:12:18 +0100 Subject: [PATCH 09/24] feat: first commit asDataFrame --- R/asDataFrameDS.R | 29 +++++++++++++++++++++++++++++ R/asDataMatrixDS.R | 23 +++++++++-------------- 2 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 R/asDataFrameDS.R diff --git a/R/asDataFrameDS.R b/R/asDataFrameDS.R new file mode 100644 index 00000000..0e31cdd2 --- /dev/null +++ b/R/asDataFrameDS.R @@ -0,0 +1,29 @@ +#' @title asDataFrameDS a serverside assign function called by ds.asDataFrame +#' @description Coerces an R object into a matrix maintaining original +#' class for all columns in data.frames. +#' @details This assign function is based on the native R function \code{data.frame} +#' @param x.name the name of the input object to be coerced to class +#' data.frame. Must be specified in inverted commas. But this argument is +#' usually specified directly by argument of the clientside function +#' \code{ds.asDataFrame} +#' @return the object specified by the argument (or its default name +#' "asdataframe.newobj") which is written to the serverside. For further +#' details see help on the clientside function \code{ds.asDataMatrix} +#' @author Tim Cadman +#' @export +asDataFrameDS <- function (x.name){ + + if(is.character(x.name)){ + x<-eval(parse(text=x.name), envir = parent.frame()) + + }else{ + studysideMessage<-"ERROR: x.name must be specified as a character string" + stop(studysideMessage, call. = FALSE) + } + + output <- data.frame(x) + + return(output) +} +# ASSIGN FUNCTION +# asDataFrameDS diff --git a/R/asDataMatrixDS.R b/R/asDataMatrixDS.R index 5add2f63..8b23f14b 100644 --- a/R/asDataMatrixDS.R +++ b/R/asDataMatrixDS.R @@ -1,22 +1,17 @@ -#' @title asDataMatrixDS a serverside assign function called by ds.asDataMatrix +#' @title asDataFrameDS a serverside assign function called by ds.asDataFrame #' @description Coerces an R object into a matrix maintaining original #' class for all columns in data.frames. -#' @details This assign function is based on the native R function \code{data.matrix} -#' If applied to a data.frame, the native R function \code{as.matrix} -#' coverts all columns into character class. In contrast, if applied to -#' a data.frame the native R function \code{data.matrix} converts -#' the data.frame to a matrix but maintains all data columns in their -#' original class +#' @details This assign function is based on the native R function \code{data.frame} #' @param x.name the name of the input object to be coerced to class -#' data.matrix. Must be specified in inverted commas. But this argument is +#' data.frame. Must be specified in inverted commas. But this argument is #' usually specified directly by argument of the clientside function -#' \code{ds.asDataMatrix} +#' \code{ds.asDataFrame} #' @return the object specified by the argument (or its default name -#' "asdatamatrix.newobj") which is written to the serverside. For further +#' "asdataframe.newobj") which is written to the serverside. For further #' details see help on the clientside function \code{ds.asDataMatrix} -#' @author Paul Burton for DataSHIELD Development Team +#' @author Tim Cadman #' @export -asDataMatrixDS <- function (x.name){ +asDataFrameDS <- function (x.name){ if(is.character(x.name)){ x<-eval(parse(text=x.name), envir = parent.frame()) @@ -26,9 +21,9 @@ if(is.character(x.name)){ stop(studysideMessage, call. = FALSE) } - output <- data.matrix(x) + output <- data.frame(x) return(output) } # ASSIGN FUNCTION -# asDataMatrixDS +# asDataFrameDS From ac1937b82a93af8ef35175b372bbcca340cefd34 Mon Sep 17 00:00:00 2001 From: Tim Cadman <41470917+timcadman@users.noreply.github.com> Date: Mon, 10 Feb 2025 14:37:53 +0100 Subject: [PATCH 10/24] test: added tests for data frame --- tests/testthat/test-smk-asDataFrameDS.R | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/testthat/test-smk-asDataFrameDS.R diff --git a/tests/testthat/test-smk-asDataFrameDS.R b/tests/testthat/test-smk-asDataFrameDS.R new file mode 100644 index 00000000..2d967f38 --- /dev/null +++ b/tests/testthat/test-smk-asDataFrameDS.R @@ -0,0 +1,47 @@ +#------------------------------------------------------------------------------- +# Copyright (c) 2019-2022 University of Newcastle upon Tyne. All rights reserved. +# +# This program and the accompanying materials +# are made available under the terms of the GNU Public License v3.0. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +#------------------------------------------------------------------------------- + +# +# Set up +# + +context("asDataFrameDS::smk::setup") + +# +# Tests +# + +context("asDataFrameDS::smk::simple") +test_that("simple asDataFrameDS", { + input <- tibble(v1 = c(0.0, 1.0, 2.0, 3.0, 4.0), v2 = c(4.0, 3.0, 2.0, 1.0, 0.0)) + + res <- asDataFrameDS("input") + + res.class <- class(res) + expect_length(res.class, 1) + expect_true("data.frame" %in% res.class) + expect_equal( + dim(res), c(5, 2) + ) + + expect_equal(res$v1, 0:4) + expect_equal(res$v2, 4:0) + res.colnames <- colnames(res) + expect_length(res.colnames, 2) + expect_equal(res.colnames[1], "v1") + expect_equal(res.colnames[2], "v2") +}) + +# +# Done +# + +context("asDataMatrixDS::smk::shutdown") +context("asDataMatrixDS::smk::done") From bf169db125b641fc87a24da0984b6b3d683286e9 Mon Sep 17 00:00:00 2001 From: Tim Cadman <41470917+timcadman@users.noreply.github.com> Date: Mon, 10 Feb 2025 14:40:02 +0100 Subject: [PATCH 11/24] docs: ran check --- NAMESPACE | 1 + man/asDataFrameDS.Rd | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 man/asDataFrameDS.Rd diff --git a/NAMESPACE b/NAMESPACE index 897148d1..4962ea20 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,6 +3,7 @@ export(BooleDS) export(absDS) export(asCharacterDS) +export(asDataFrameDS) export(asDataMatrixDS) export(asFactorDS1) export(asFactorDS2) diff --git a/man/asDataFrameDS.Rd b/man/asDataFrameDS.Rd new file mode 100644 index 00000000..8e1b1029 --- /dev/null +++ b/man/asDataFrameDS.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/asDataFrameDS.R +\name{asDataFrameDS} +\alias{asDataFrameDS} +\title{asDataFrameDS a serverside assign function called by ds.asDataFrame} +\usage{ +asDataFrameDS(x.name) +} +\arguments{ +\item{x.name}{the name of the input object to be coerced to class +data.frame. Must be specified in inverted commas. But this argument is +usually specified directly by argument of the clientside function +\code{ds.asDataFrame}} +} +\value{ +the object specified by the argument (or its default name +"asdataframe.newobj") which is written to the serverside. For further +details see help on the clientside function \code{ds.asDataMatrix} +} +\description{ +Coerces an R object into a matrix maintaining original +class for all columns in data.frames. +} +\details{ +This assign function is based on the native R function \code{data.frame} +} +\author{ +Tim Cadman +} From 89837f02c316578c0cd7106204e9ceae91c11003 Mon Sep 17 00:00:00 2001 From: davraam Date: Wed, 14 May 2025 15:50:57 +0300 Subject: [PATCH 12/24] improve code and increase test coverage --- DESCRIPTION | 1 + NAMESPACE | 1 - R/BooleDS.R | 201 +++++++----------- R/asCharacterDS.R | 2 +- R/asFactorDS2.R | 4 +- man/BooleDS.Rd | 9 +- man/asDataFrameDS.Rd | 13 +- man/asDataMatrixDS.Rd | 34 --- man/asFactorDS2.Rd | 4 +- .../disclosure/set_disclosure_settings.R | 24 +++ tests/testthat/test-smk-BooleDS.R | 24 +++ tests/testthat/test-smk-asFactorDS1.R | 43 ++++ 12 files changed, 189 insertions(+), 171 deletions(-) delete mode 100644 man/asDataMatrixDS.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 74d5ea70..4265275a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,6 +21,7 @@ Imports: childsds, purrr, tibble, + tidyselect, tidyverse Suggests: testthat diff --git a/NAMESPACE b/NAMESPACE index 655cae99..1a107e36 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,7 +4,6 @@ export(BooleDS) export(absDS) export(asCharacterDS) export(asDataFrameDS) -export(asDataMatrixDS) export(asFactorDS1) export(asFactorDS2) export(asFactorSimpleDS) diff --git a/R/BooleDS.R b/R/BooleDS.R index e4c04548..a4c2968c 100644 --- a/R/BooleDS.R +++ b/R/BooleDS.R @@ -16,10 +16,9 @@ #' the final output variable #' should be of class numeric (1/0) or class logical (TRUE/FALSE). #' @param na.assign.text A character string taking values 'NA', '1' or '0'. If 'NA' -#' then any NA values in the -#' input vector remain as NAs in the output vector. If '1' or '0' NA values in the -#' input vector are -#' all converted to 1 or 0 respectively.#' @return the levels of the input variable. +#' then any NA values in the input vector remain as NAs in the output vector. If '1' +#' or '0' NA values in the input vector are all converted to 1 or 0 respectively. +#' @return the levels of the input variable. #' @author DataSHIELD Development Team #' @export #' @@ -28,127 +27,77 @@ BooleDS <- function(V1.name=NULL, V2.name=NULL, Boolean.operator.n=NULL, na.assi # Check Permissive Privacy Control Level. dsBase::checkPermissivePrivacyControlLevel(c('permissive', 'banana')) -######################################################################### -# DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS # -thr <- dsBase::listDisclosureSettingsDS() # -#nfilter.tab<-as.numeric(thr$nfilter.tab) # -#nfilter.glm<-as.numeric(thr$nfilter.glm) # -#nfilter.subset<-as.numeric(thr$nfilter.subset) # -#nfilter.string<-as.numeric(thr$nfilter.string) # -#nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) # -#nfilter.kNN<-as.numeric(thr$nfilter.kNN) # -#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) # -######################################################################### - - -#V1: numeric, factor or logical vector or scalar in .GlobalEnv -#V2: numeric, factor or logical vector or scalar in .GlobalEnv or client specified scalar with which to compare V1 - -#EVAL V1 and V2 - -##########CHECK NOT LONG SPECIFIED VECTOR############## - -V1<-eval(parse(text=V1.name), envir = parent.frame()) -V2<-eval(parse(text=V2.name), envir = parent.frame()) - - -if(is.character(V1)){ - studysideMessage<-"FAILED: V_i is character, please convert to numeric, factor or logical before running Boole" - stop(studysideMessage, call. = FALSE) - } - -if(is.character(V2)){ - studysideMessage<-"FAILED: V_ii is character, please convert to numeric, factor or logical before running Boole" - stop(studysideMessage, call. = FALSE) - } - -V1.length<-length(V1) -V2.length<-length(V2) - -if(!((V1.length == V2.length) | (V2.length==1))){ - studysideMessage<-"FAILED: V_ii must either be of length one or of length equal to V_i" - stop(studysideMessage, call. = FALSE) -} - -if(!is.numeric(Boolean.operator.n) | Boolean.operator.n==0){ - studysideMessage<-"FAILED: Boolean.operator specified incorrectly. Must be: '==', '!=', '<', '<=', '>' or '>='" - stop(studysideMessage, call. = FALSE) -} - -Boolean.operator<-" " -if(Boolean.operator.n==1) Boolean.operator<-"==" -if(Boolean.operator.n==2) Boolean.operator<-"!=" -if(Boolean.operator.n==3) Boolean.operator<-"<" -if(Boolean.operator.n==4) Boolean.operator<-"<=" -if(Boolean.operator.n==5) Boolean.operator<-">" -if(Boolean.operator.n==6) Boolean.operator<-">=" - - -#APPLY BOOLEAN OPERATOR SPECIFIED - -Boolean.indicator<-integer(length=V1.length) - -#EVALUATE DIFFERENTLY IF V2 IS SAME LENGTH AS V1 OR OF LENGTH 1 -if(V2.length==V1.length){ -for(j in 1:V1.length){ -command.text<-paste0(V1.name,"[",j,"] ",Boolean.operator," ",V2.name,"[",j,"]") -Boolean.indicator[j]<-eval(parse(text=command.text), envir = parent.frame())*1 -} -} - -if(V2.length==1){ -for(j in 1:V1.length){ -command.text<-paste0(V1.name,"[",j,"] ",Boolean.operator," ",V2.name) -Boolean.indicator[j]<-eval(parse(text=command.text), envir = parent.frame())*1 -} -} - - -#BY DEFAULT NAs REMAIN AS NAs BUT IF YOU WANT TO YOU CAN FORCE THEM TO 1 OR 0 USING ARGUMENT - -if(na.assign.text=="1"){ -Boolean.indicator[is.na(Boolean.indicator)==1]<-1 -} - -if(na.assign.text=="0"){ -Boolean.indicator[is.na(Boolean.indicator)==1]<-0 -} - - -outobj.b<-as.logical(Boolean.indicator) -outobj<-Boolean.indicator - - - -#COMMENT OUT THIS CODE BLOCK BECAUSE TESTS OF MINIMUM CELL SIZE SHOULD ALL BE -#ENACTED IN AGGREGATE FUNCTIONS. NO VECTOR IS DISCLOSIVE UNTIL IT RETURNS -#SOMETHING TO THE CLIENTSIDE. I AM LEAVING THIS COMMENTED BUT UNDELETED -#IN CASE WE LATER DECIDE TO CHANGE THIS STRATEGY -#CHECK OUTPUT VECTOR VALIDITY -# outobj.invalid<-0 -# -# unique.values.outobj<-unique(outobj) -# unique.values.noNA.outobj<-unique.values.outobj[complete.cases(unique.values.outobj)] -# -# #Boolean and can therefore only be binary so check this: -# if(length(unique.values.noNA.outobj)>2) outobj.invalid<-1 -# -# tabvar<-table(outobj,useNA="no")[table(outobj,useNA="no")>=1] -# min.category<-min(tabvar) -# if(min.category' or '>='" + stop(studysideMessage, call. = FALSE) + } + + Boolean.operator <- " " + if(Boolean.operator.n==1) Boolean.operator <- "==" + if(Boolean.operator.n==2) Boolean.operator <- "!=" + if(Boolean.operator.n==3) Boolean.operator <- "<" + if(Boolean.operator.n==4) Boolean.operator <- "<=" + if(Boolean.operator.n==5) Boolean.operator <- ">" + if(Boolean.operator.n==6) Boolean.operator <- ">=" + + # APPLY BOOLEAN OPERATOR SPECIFIED + Boolean.indicator <- integer(length=V1.length) + + # EVALUATE DIFFERENTLY IF V2 IS SAME LENGTH AS V1 OR OF LENGTH 1 + if(V2.length==V1.length){ + for(j in 1:V1.length){ + command.text <- paste0(V1.name,"[",j,"] ",Boolean.operator," ",V2.name,"[",j,"]") + Boolean.indicator[j]<-eval(parse(text=command.text), envir = parent.frame())*1 + } + } + + if(V2.length==1){ + for(j in 1:V1.length){ + command.text<-paste0(V1.name,"[",j,"] ",Boolean.operator," ",V2.name) + Boolean.indicator[j]<-eval(parse(text=command.text), envir = parent.frame())*1 + } + } + + # BY DEFAULT NAs REMAIN AS NAs BUT IF YOU WANT TO YOU CAN FORCE THEM TO 1 OR 0 USING ARGUMENT + if(na.assign.text=="1"){ + Boolean.indicator[is.na(Boolean.indicator)==1]<-1 + } + + if(na.assign.text=="0"){ + Boolean.indicator[is.na(Boolean.indicator)==1]<-0 + } + + outobj.b <- as.logical(Boolean.indicator) + outobj <- Boolean.indicator + + if(numeric.output==TRUE){ + Boole.obj <- outobj + }else{ + Boole.obj <- outobj.b + } + + return(Boole.obj) } -#ASSIGN FUNCTION +# ASSIGN FUNCTION # BooleDS diff --git a/R/asCharacterDS.R b/R/asCharacterDS.R index 04b6b70a..dc6e48a5 100644 --- a/R/asCharacterDS.R +++ b/R/asCharacterDS.R @@ -12,7 +12,7 @@ #' @author Amadou Gaye, Paul Burton, Demetris Avraam for DataSHIELD Development Team #' @export #' -asCharacterDS <- function (x.name){ +asCharacterDS <- function(x.name){ x <- eval(parse(text=x.name), envir = parent.frame()) diff --git a/R/asFactorDS2.R b/R/asFactorDS2.R index c744bfc5..6fecabfe 100644 --- a/R/asFactorDS2.R +++ b/R/asFactorDS2.R @@ -4,12 +4,12 @@ #' a factor type that presented as a vector or as a matrix with dummy variables. #' @details The functions converts the input variable into a factor which is presented as a vector #' if the \code{fixed.dummy.vars} is set to FALSE or as a matrix with dummy variables if the -#' \code{fixed.dummy.vars} is set to TRUE (see the help file of ds.asFactor.b for more details). +#' \code{fixed.dummy.vars} is set to TRUE (see the help file of ds.asFactor for more details). #' @param input.var.name the name of the variable that is to be converted to a factor. #' @param all.unique.levels.transmit the levels that the variable will be transmitted to. #' @param fixed.dummy.vars a boolean that determines whether the new object will be represented as #' a vector or as a matrix of dummy variables indicating the factor level of each data point. -#' If this argyment is set to FALSE (default) then the input variable is converted to a factor and +#' If this argument is set to FALSE (default) then the input variable is converted to a factor and #' assigned as a vector. If is set to TRUE then the input variable is converted to a factor but #' assigned as a matrix of dummy variables. #' @param baseline.level a number indicating the baseline level to be used in the creation of the diff --git a/man/BooleDS.Rd b/man/BooleDS.Rd index 50eb4197..876620c4 100644 --- a/man/BooleDS.Rd +++ b/man/BooleDS.Rd @@ -26,15 +26,16 @@ that could legally be passed from client to server via DataSHIELD parser} \item{na.assign.text}{A character string taking values 'NA', '1' or '0'. If 'NA' -then any NA values in the -input vector remain as NAs in the output vector. If '1' or '0' NA values in the -input vector are -all converted to 1 or 0 respectively.#' @return the levels of the input variable.} +then any NA values in the input vector remain as NAs in the output vector. If '1' +or '0' NA values in the input vector are all converted to 1 or 0 respectively.} \item{numeric.output}{a TRUE/FALSE indicator defaulting to TRUE determining whether the final output variable should be of class numeric (1/0) or class logical (TRUE/FALSE).} } +\value{ +the levels of the input variable. +} \description{ Converts the individual elements of a vector or other object into Boolean indicators. diff --git a/man/asDataFrameDS.Rd b/man/asDataFrameDS.Rd index 8e1b1029..ceb08741 100644 --- a/man/asDataFrameDS.Rd +++ b/man/asDataFrameDS.Rd @@ -1,9 +1,11 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/asDataFrameDS.R +% Please edit documentation in R/asDataFrameDS.R, R/asDataMatrixDS.R \name{asDataFrameDS} \alias{asDataFrameDS} \title{asDataFrameDS a serverside assign function called by ds.asDataFrame} \usage{ +asDataFrameDS(x.name) + asDataFrameDS(x.name) } \arguments{ @@ -13,15 +15,24 @@ usually specified directly by argument of the clientside function \code{ds.asDataFrame}} } \value{ +the object specified by the argument (or its default name +"asdataframe.newobj") which is written to the serverside. For further +details see help on the clientside function \code{ds.asDataMatrix} + the object specified by the argument (or its default name "asdataframe.newobj") which is written to the serverside. For further details see help on the clientside function \code{ds.asDataMatrix} } \description{ +Coerces an R object into a matrix maintaining original +class for all columns in data.frames. + Coerces an R object into a matrix maintaining original class for all columns in data.frames. } \details{ +This assign function is based on the native R function \code{data.frame} + This assign function is based on the native R function \code{data.frame} } \author{ diff --git a/man/asDataMatrixDS.Rd b/man/asDataMatrixDS.Rd deleted file mode 100644 index 1a87b0d2..00000000 --- a/man/asDataMatrixDS.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/asDataMatrixDS.R -\name{asDataMatrixDS} -\alias{asDataMatrixDS} -\title{asDataMatrixDS a serverside assign function called by ds.asDataMatrix} -\usage{ -asDataMatrixDS(x.name) -} -\arguments{ -\item{x.name}{the name of the input object to be coerced to class -data.matrix. Must be specified in inverted commas. But this argument is -usually specified directly by argument of the clientside function -\code{ds.asDataMatrix}} -} -\value{ -the object specified by the argument (or its default name -"asdatamatrix.newobj") which is written to the serverside. For further -details see help on the clientside function \code{ds.asDataMatrix} -} -\description{ -Coerces an R object into a matrix maintaining original -class for all columns in data.frames. -} -\details{ -This assign function is based on the native R function \code{data.matrix} -If applied to a data.frame, the native R function \code{as.matrix} -coverts all columns into character class. In contrast, if applied to -a data.frame the native R function \code{data.matrix} converts -the data.frame to a matrix but maintains all data columns in their -original class -} -\author{ -Paul Burton for DataSHIELD Development Team -} diff --git a/man/asFactorDS2.Rd b/man/asFactorDS2.Rd index b97f3cc4..fff7b73b 100644 --- a/man/asFactorDS2.Rd +++ b/man/asFactorDS2.Rd @@ -18,7 +18,7 @@ asFactorDS2( \item{fixed.dummy.vars}{a boolean that determines whether the new object will be represented as a vector or as a matrix of dummy variables indicating the factor level of each data point. -If this argyment is set to FALSE (default) then the input variable is converted to a factor and +If this argument is set to FALSE (default) then the input variable is converted to a factor and assigned as a vector. If is set to TRUE then the input variable is converted to a factor but assigned as a matrix of dummy variables.} @@ -35,5 +35,5 @@ a factor type that presented as a vector or as a matrix with dummy variables. \details{ The functions converts the input variable into a factor which is presented as a vector if the \code{fixed.dummy.vars} is set to FALSE or as a matrix with dummy variables if the -\code{fixed.dummy.vars} is set to TRUE (see the help file of ds.asFactor.b for more details). +\code{fixed.dummy.vars} is set to TRUE (see the help file of ds.asFactor for more details). } diff --git a/tests/testthat/disclosure/set_disclosure_settings.R b/tests/testthat/disclosure/set_disclosure_settings.R index 4642cc53..4ee70213 100644 --- a/tests/testthat/disclosure/set_disclosure_settings.R +++ b/tests/testthat/disclosure/set_disclosure_settings.R @@ -24,3 +24,27 @@ set.standard.disclosure.settings <- function() { options(default.nfilter.levels.density = "0.33") options(default.nfilter.levels.max = "40") } + +set.specific.disclosure.settings <- function(datashield.privacyControlLevel='permissive', + nfilter.tab='3', + nfilter.subset='3', + nfilter.glm='0.33', + nfilter.string='80', + nfilter.stringShort='20', + nfilter.kNN='3', + nfilter.levels.density='0.33', + nfilter.levels.max='40', + nfilter.noise='0.25', + nfilter.privacy.old='5') { + options(datashield.privacyLevel = nfilter.privacy.old) + options(default.datashield.privacyControlLevel = datashield.privacyControlLevel) + options(default.nfilter.glm = nfilter.glm) + options(default.nfilter.kNN = nfilter.kNN) + options(default.nfilter.string = nfilter.string) + options(default.nfilter.subset = nfilter.subset) + options(default.nfilter.stringShort = nfilter.stringShort) + options(default.nfilter.tab = nfilter.tab) + options(default.nfilter.noise = nfilter.noise) + options(default.nfilter.levels.density = nfilter.levels.density) + options(default.nfilter.levels.max = nfilter.levels.max) +} diff --git a/tests/testthat/test-smk-BooleDS.R b/tests/testthat/test-smk-BooleDS.R index dd10c782..c7ee5af0 100644 --- a/tests/testthat/test-smk-BooleDS.R +++ b/tests/testthat/test-smk-BooleDS.R @@ -18,6 +18,30 @@ context("BooleDS::smk::setup") # Tests # +context("BooleDS::smk::make errors") +test_that("make errors, character V1", { + input <- data.frame(v1 = c('0.0', '1.0', '2.0', '3.0', '4.0'), v2 = c(4.0, 3.0, 2.0, 1.0, 0.0)) + expect_error(BooleDS("input$v1", "input$v2", 1, "NA", TRUE), "FAILED: V1 is character, please convert to numeric, factor or logical before running Boole", fixed=TRUE) +}) + +test_that("make errors, character V2", { + input <- data.frame(v1 = c(0.0, 1.0, 2.0, 3.0, 4.0), v2 = c('4.0', '3.0', '2.0', '1.0', '0.0')) + expect_error(BooleDS("input$v1", "input$v2", 1, "NA", TRUE), "FAILED: V2 is character, please convert to numeric, factor or logical before running Boole", fixed=TRUE) +}) + +test_that("make errors, V1 and V2 are vectors of different length", { + v1 = c(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0) + v2 = c(4.0, 3.0, 2.0, 1.0, 0.0) + expect_error(BooleDS("v1", "v2", 1, "NA", TRUE), "FAILED: V2 must either be of length one or of length equal to V1", fixed=TRUE) +}) + +test_that("make errors, incorrect Boolean operator", { + v1 = c(0.0, 1.0, 2.0, 3.0, 4.0) + v2 = c(4.0, 3.0, 2.0, 1.0, 0.0) + boolean.op = 10 + expect_error(BooleDS("v1", "v2", boolean.op, "NA", TRUE), "FAILED: Boolean.operator specified incorrectly. Must be: '==', '!=', '<', '<=', '>' or '>='", fixed=TRUE) +}) + context("BooleDS::smk::simple equal") test_that("simple BooleDS, equal numeric", { input <- data.frame(v1 = c(0.0, 1.0, 2.0, 3.0, 4.0), v2 = c(4.0, 3.0, 2.0, 1.0, 0.0)) diff --git a/tests/testthat/test-smk-asFactorDS1.R b/tests/testthat/test-smk-asFactorDS1.R index fd59cefc..78d44bf7 100644 --- a/tests/testthat/test-smk-asFactorDS1.R +++ b/tests/testthat/test-smk-asFactorDS1.R @@ -33,6 +33,49 @@ test_that("simple asFactorDS1", { expect_equal(res[3], "3") }) +context("asFactorDS1::smk::make errors") +test_that("make errors, vector with more unique values than nfilter.levels.max", { + input <- c(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0) + + factor.levels.present.in.source <- levels(factor(input)) + num.levels <- length(factor.levels.present.in.source) + + thr <- dsBase::listDisclosureSettingsDS() + nfilter.levels.density <- as.numeric(thr$nfilter.levels.density) + nfilter.levels.max <- as.numeric(thr$nfilter.levels.max) + max.levels.by.density <- nfilter.levels.density*length(input) + + error.message <- 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") + + expect_error(asFactorDS1("input"), error.message, fixed=TRUE) +}) + +test_that("make errors, vector with more levels than nfilter.levels.max", { + input <- c(2.0, 1.0, 3.0, 3.0, 3.0, 1.0, 2.0, 2.0, 1.0, 2.0) + + factor.levels.present.in.source <- levels(factor(input)) + num.levels <- length(factor.levels.present.in.source) + + set.specific.disclosure.settings(nfilter.levels.max='2') + + thr <- dsBase::listDisclosureSettingsDS() + nfilter.levels.density <- as.numeric(thr$nfilter.levels.density) + nfilter.levels.max <- as.numeric(thr$nfilter.levels.max) + max.levels.by.density <- nfilter.levels.density*length(input) + + error.message <- 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") + + expect_error(asFactorDS1("input"), error.message, fixed=TRUE) +}) + + # # Done # From 55a7644a870eb18a42cd52ed6e47a287d4975005 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Sun, 13 Jul 2025 08:29:31 +0100 Subject: [PATCH 13/24] Added packages --- azure-pipelines.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index abbcc444..86557410 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -119,6 +119,10 @@ jobs: sudo R -e "install.packages('mice', dependencies=TRUE)" sudo R -e "install.packages('data.table', dependencies=TRUE)" sudo R -e "install.packages('childsds', dependencies=TRUE)" + sudo R -e "install.packages('purrr', dependencies=TRUE)" + sudo R -e "install.packages('tibble', dependencies=TRUE)" + sudo R -e "install.packages('tidyselect', dependencies=TRUE)" + sudo R -e "install.packages('tidyverse', dependencies=TRUE)" displayName: 'Install all dependencies for dsBase' condition: succeeded() From c84372ddd7202e1fdf94a26f57c7e521dee50976 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Sun, 13 Jul 2025 12:05:03 +0100 Subject: [PATCH 14/24] Remove 'tidyverse' --- DESCRIPTION | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 16eb7948..31c7e951 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -59,8 +59,7 @@ Imports: childsds, purrr, tibble, - tidyselect, - tidyverse + tidyselect Suggests: testthat RoxygenNote: 7.3.2 From 220d58691f16fbb9188ffa046c538b8ec6557869 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Sun, 13 Jul 2025 22:58:23 +0100 Subject: [PATCH 15/24] Initial fixes due to update --- DESCRIPTION | 3 ++- azure-pipelines.yml | 2 +- tests/testthat/helper.R | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 31c7e951..d27c2dbb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -59,7 +59,8 @@ Imports: childsds, purrr, tibble, - tidyselect + tidyselect, + tidytable Suggests: testthat RoxygenNote: 7.3.2 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 86557410..a36b42c3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -122,7 +122,7 @@ jobs: sudo R -e "install.packages('purrr', dependencies=TRUE)" sudo R -e "install.packages('tibble', dependencies=TRUE)" sudo R -e "install.packages('tidyselect', dependencies=TRUE)" - sudo R -e "install.packages('tidyverse', dependencies=TRUE)" + sudo R -e "install.packages('tidytable', dependencies=TRUE)" displayName: 'Install all dependencies for dsBase' condition: succeeded() diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index e27e90e5..403fdfb9 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -37,7 +37,7 @@ create_mixed_dataframe <- function(n_rows = 10000, n_factor_cols = 15, n_other_c c("Summer", "Winter", "Spring", "Fall") ) - factor_columns <- map_dfc(factor_levels[1:n_factor_cols], create_factor_column) + factor_columns <- purrr::map_dfc(factor_levels[1:n_factor_cols], create_factor_column) colnames(factor_columns) <- paste0("fac_col", 1:n_factor_cols) create_other_column <- function(type, n = n_rows) { @@ -55,7 +55,7 @@ create_mixed_dataframe <- function(n_rows = 10000, n_factor_cols = 15, n_other_c "num", "str", "int", "num", "str" ) - other_columns <- map_dfc(column_types[1:n_other_cols], create_other_column) + other_columns <- purrr::map_dfc(column_types[1:n_other_cols], create_other_column) colnames(other_columns) <- paste0("col", (n_factor_cols + 1):(n_factor_cols + n_other_cols)) df <- bind_cols(factor_columns, other_columns) From e9663b9353320b57ef3d6e6f40bbc846d7f9a6ca Mon Sep 17 00:00:00 2001 From: davraam Date: Wed, 4 Feb 2026 14:52:04 +0100 Subject: [PATCH 16/24] update output call object to include actual formula --- R/glmSLMADS.assign.R | 51 ++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/R/glmSLMADS.assign.R b/R/glmSLMADS.assign.R index 275e1f47..f7b5fff4 100644 --- a/R/glmSLMADS.assign.R +++ b/R/glmSLMADS.assign.R @@ -18,40 +18,25 @@ #' @export glmSLMADS.assign <- function(formula, family, offsetName, weightsName, dataName){ -############################################################# -#MODULE 1: CAPTURE THE nfilter SETTINGS # -thr <- dsBase::listDisclosureSettingsDS() # -nfilter.tab <- as.numeric(thr$nfilter.tab) # -nfilter.glm <- as.numeric(thr$nfilter.glm) # -#nfilter.subset<-as.numeric(thr$nfilter.subset) # -#nfilter.string<-as.numeric(thr$nfilter.string) # -############################################################# - -######################################## -############ -#Convert transmitable text for special link variance combinations back to full representation -if(family=="quasigamma.link_log") -{family<-"quasi(link=log,variance=mu^2)"} - -if(family=="Gamma.link_log") -{family<-"Gamma(link=log)"} -############# - -#Activate family object (this may not be necessary as character string may already be OK -#but just checking -final.family.object<-eval(parse(text=family)) - - -#Correctly name offset, weights and data objects in function call -#(to allow glmPredict to work correctly later) -calltext<-paste0("mg<-glm(formula,family=",family,",offset=", - offsetName,",weights=",weightsName,",data=", dataName,",x=TRUE)") - -eval(parse(text=calltext)) - -return(mg) + # Convert transmitable text for special link variance combinations back to full representation + if(family=="quasigamma.link_log") + {family<-"quasi(link=log,variance=mu^2)"} + + if(family=="Gamma.link_log") + {family<-"Gamma(link=log)"} + + # Correctly name offset, weights and data objects in function call + # (to allow glmPredict to work correctly later) + calltext <- paste0("mg<-glm(formula,family=",family,",offset=", + offsetName,",weights=",weightsName,",data=", dataName,",x=TRUE)") + + eval(parse(text=calltext)) + + # update the call object to include the actual formula + mg$call$formula <- formula + + return(mg) } - # ASSIGN FUNCTION # glmSLMADS.assign From 23019c09b08b20514537e45016fdeb1b99570be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Z=C3=BClal=20Bekerecio=C4=9Flu?= Date: Thu, 5 Feb 2026 12:41:34 +0100 Subject: [PATCH 17/24] New implementations (date, predict, round, scale) --- R/dateDS.R | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++ R/predictDS.R | 138 +++++++++++++++++++++++++++++++++++++ R/roundDS.R | 77 +++++++++++++++++++++ R/scaleDS.R | 61 ++++++++++++++++ 4 files changed, 463 insertions(+) create mode 100644 R/dateDS.R create mode 100644 R/predictDS.R create mode 100644 R/roundDS.R create mode 100644 R/scaleDS.R diff --git a/R/dateDS.R b/R/dateDS.R new file mode 100644 index 00000000..ed54bf67 --- /dev/null +++ b/R/dateDS.R @@ -0,0 +1,187 @@ +#' +#' @title dateDS +#' @description Takes an object that is either a data-frame column or a vector, and can do extraction of +#' components of full date (\code{extractdate}), can combine date components to a full date (\code{makedate}), +#' or can calculate the time between two dates (\code{timebetween}). +#' +#' @details +#' If the input is a data-frame column, it must be provided in the \code{x} argument as data-frame$column. +#' Inputs for \code{extractdate} and \code{timebetween} must be date objects. +#' For \code{makedate}, three numeric vectors (year, month, day) must be provided in the correct order. +#' The \code{add.column} argument determines whether the result is added as a new column in the existing +#' data-frame (\code{TRUE}), or created as a new server-side object (\code{FALSE}). +#' Note: \code{add.column = TRUE} is only valid for data-frame inputs. +#' +#' +#' @param x Character vector specifying the server-side object(s). For data-frame columns, use the format \code{df$column}. +#' @param type Character string specifying the operation: \code{"extractdate"}, \code{"makedate"}, or \code{"timebetween"}. +#' @param newobj Character string for the name of the object that will be created on the server. Default is \code{"date.result"}. +#' @param unit Character string specifying the unit for \code{extractdate} or \code{timebetween}: \code{"days"}, \code{"months"}, or \code{"years"}. +#' @param add.column Logical. If \code{FALSE}, the result is created as a new server-side object; +#' if \code{TRUE}, the result is added as a new column in the existing data-frame. Default is \code{FALSE}. +#' +#' +#' @author Zulal Bekerecioglu +#' @return the created numeric vector or date object, or the updated dataframe with the added column +#' @export +#' +#' +dateDS <- function(x=NULL, type=NULL, + newobj=NULL, unit=NULL, add.column=NULL) { + + library(lubridate) + add.column <- as.logical(add.column) + + # If argument not in c("extractdate", "makedate", "timebetween") throw an error + if (!(type %in% c("extractdate", "makedate", "timebetween"))) { + stop("Invalid argument. Must be one of: ", paste(c("extractdate", "makedate", "timebetween"), collapse=", ")) + } + + # Check if input(s) are valid. + error_message <- "Input object couldn't be found. Please provide the correct format. + For vectors, supply an existing object name; for columns, use the format dataframe$column, + where 'dataframe' is the name of the data frame and 'column' is the column name, + and ensure that both exist." + + + # If x is NULL, throw and error. + if (is.null(x)) { + stop(error_message, call. = FALSE) + } + + # Each argument takes a unique number of elements, check if they match. + if (length(x) != 1 && type=="extractdate") { + stop(paste0("Invalid input length for argument '", type, "'. Expected ", 1, + " elements, but received ", length(x), ". Please provide exactly ", 1, + " object name(s) or column(s)."), call. = FALSE) + } + + if (length(x) != 3 && type=="makedate") { + stop(paste0("Invalid input length for argument '", type, "'. Expected ", 3, + " elements, but received ", length(x), ". Please provide exactly ", 3, + " object name(s) or column(s)."), call. = FALSE) + } + + if (length(x) != 2 && type=="timebetween") { + stop(paste0("Invalid input length for argument '", type, "'. Expected ", 2, + " elements, but received ", length(x), ". Please provide exactly ", 2, + " object name(s) or column(s)."), call. = FALSE) + } + + inputs <- vector("list", length(x)) + + # When add.column = TRUE, the client function ensures that at least one input is a column, + # and if multiple columns are provided, they all come from the same data-frame. + # Therefore, it is safe to use any of these data-frames as common_df on the server. + common_df <- NULL + + for (i in seq_along(x)) { + element <- x[i] + + # Each element must be a single string + if (!is.character(element) || length(element) != 1) stop(error_message, call. = FALSE) + + # Check if it is a df$col reference + if (grepl("\\$", element, perl = TRUE)) { + parts <- strsplit(element, "\\$", perl = TRUE)[[1]] + + # Validate both parts + if (length(parts) != 2 || !nzchar(parts[1]) || !nzchar(parts[2])) stop(error_message, call. = FALSE) + + # Try to get the dataframe + df <- tryCatch(get(parts[1]), error = function(e) NULL) + if (is.null(df)) stop(error_message, call. = FALSE) + + # Check that column exists + if (!(parts[2] %in% names(df))) stop(error_message, call. = FALSE) + + # Save the column values in the list + inputs[[i]] <- df[[parts[2]]] + common_df <- parts[1] + + } else { + # It's a plain object, just get it + obj <- tryCatch(get(element), error = function(e) NULL) + if (is.null(obj)) stop(error_message, call. = FALSE) + + inputs[[i]] <- obj + } + } + + + # extractdate + # x should be a column name or object with a date format, type should be provided, + # a new column or object with outputcolname will be created + if (type == "extractdate") { + + # Only one input is expected + date_input <- inputs[[1]] + + # Extract the requested component + result <- switch(unit, + days = day(date_input), + months = month(date_input), + years = year(date_input), + stop("Invalid unit. Must be one of: days, months, years")) + } + + + # makedate + # inputcolname should be list of 3 strings: year-month-day + if (type == "makedate") { + + # inputs[[1]] = year, inputs[[2]] = month, inputs[[3]] = day + year_vec <- as.numeric(inputs[[1]]) + month_vec <- as.numeric(inputs[[2]]) + day_vec <- as.numeric(inputs[[3]]) + + # Basic plausibility checks + if (length(unique(sapply(list(year_vec, month_vec, day_vec), length))) != 1) { + stop("Inputs for 'makedate' must be of equal length.", call. = FALSE) + } + + if (any(year_vec < 1000 | year_vec > 3000, na.rm = TRUE)) { + stop("The 'year' input in 'makedate' must contain plausible 4-digit years (1000–3000). + Check that year, month, and day are given in the correct order (year, month, day).", call. = FALSE) + } + if (any(month_vec < 1 | month_vec > 12, na.rm = TRUE)) { + stop("The 'month' input in 'makedate' must contain values between 1 and 12. + Check that year, month, and day are given in the correct order (year, month, day).", call. = FALSE) + } + if (any(day_vec < 1 | day_vec > 31, na.rm = TRUE)) { + stop("The 'day' input in 'makedate' must contain values between 1 and 31. + Check that year, month, and day are given in the correct order (year, month, day).", call. = FALSE) + } + + + result <- make_date(year = year_vec, + month = month_vec, + day = day_vec) + } + + + # timebetween + # inputcolname should be a list of 2 strings: start and end date + if (type == "timebetween") { + + # inputs[[1]] = start date, inputs[[2]] = end date + units <- list( + years = years(1), + months = months(1), + days = days(1) + ) + + result <- interval(inputs[[1]], inputs[[2]]) %/% units[[unit]] + } + + # Save result based on add.column + if (!add.column) { + return(result) + } else { + # Assign to common_df as a new column + df <- get(common_df) + df[[newobj]] <- result + return(df) + } + +} diff --git a/R/predictDS.R b/R/predictDS.R new file mode 100644 index 00000000..e42c8beb --- /dev/null +++ b/R/predictDS.R @@ -0,0 +1,138 @@ +#' +#' @title predictDS +#' @description Generates server-side predictions using the client-side output from \code{ds.glm}. +#' +#' @details +#' This function uses the components supplied by the client-side function (coefficients, family, formula, +#' and any categorical variables) to generate predictions on the server. To use the base R \code{predict()} function, +#' a "dummy" glm object is created using the same model formula, family, and link function as the original model. +#' The dummy model's coefficients are then replaced with the client-side coefficient estimates. +#' +#' To avoid mismatches between the factors used in the original glm and those in the dummy glm, the categorical +#' variables saved by the client-side function are applied to the newdata. +#' +#' For intercept-only models, the function simply returns a vector of predicted values equal to the model intercept, with the appropriate length +#' based on the row length of \code{newdataname}. +#' +#' +#' @param newdataname A character string specifying the name of the new dataset to be used for predictions. +#' @param traindataname A character string specifying the name of the dataset used for model training. +#' @param type A character string specifying the type of prediction. Options are \code{"response"} or \code{"link"}. +#' @param na.action A character string to specify the action to take if missing values are present. Default is \code{"na.pass"}. +#' +#' +#' @author Zulal Bekerecioglu +#' @return a numeric vector containing the predicted values +#' @export +#' +#' +predictDS <- function(newdataname, traindataname, type = c("response", "link"), + na.action = "na.pass") { + + # Get the objects saved by the client function ds.predict + coefficients<-get("predictDS_coefficients") + model_formula <-get("predictDS_formula") + family <- get("predictDS_family") + categorical_variables <- get("predictDS_categorical_variables") + + + + if(!is.null(traindataname)) + { + traindata<-get(traindataname) + + }else{ + stop("'traindataname' couldn't be found, please provide a valid object name.", call.=FALSE) + } + + + if(!is.null(newdataname)) + { + newdf<-get(newdataname) + + }else{ + stop("'newdataname' couldn't be found, please provide a valid object name.", call.=FALSE) + } + + if (!is.character(type) || !(type %in% c("link","response"))) { + stop("Invalid argument. Must be one of: 'link','response'.", call. = FALSE) + } + + # Convert the family object to it's corresponding function, i.e. poisson.link.log -> poisson(link= "log") + family_dist <- strsplit(family, "\\.")[[1]] + + family_name <- family_dist[1] # "binomial" + link_name <- family_dist[3] # "logit" + + family_func <- get(family_name) # gets the function binomial() + family_obj <- family_func(link = link_name) + + + + # SPECIAL CASE HANDLING: y ~ 1, intercept only ###################### + # A numeric vector will be created wit the mean, with the same length as the row number in newdataname + special_case <- length(attr(terms(formula(model_formula)), "term.labels")) == 0 + + if(special_case){ + intercept <- coefficients + + # If the input is just a numeric vector, get the length + if(class(newdf)=="numeric"){ + predictions.f <- rep(intercept, length(newdf)) + } else if(class(newdf)=="data.frame"){ + predictions.f <- rep(intercept, nrow(newdf)) # Otherwise use the number of rows + } else { + stop("Invalid input: The object called 'newdataname' must be either a numeric vector or a data.frame.",, call. = FALSE) + } + + if (type == "link") { + predictions.f <- predictions.f + } else if (family_name == "gaussian") { # if type is 'response' + # identity + predictions.f <- predictions.f + } else if (family_name == "poisson") { + # log + predictions.f <- exp(predictions.f) + } else if (family_name == "binomial") { + # logit + predictions.f <- plogis(predictions.f) + } else { + stop("Unsupported family for intercept-only prediction: Family must be either Gaussian, Poisson, or Binomial.", call. = FALSE) + } + + return(predictions.f) + } + # END OF SPECIAL CASE ###################### + + + + # Fix factor levels if any exists + for (var in categorical_variables) { + + # First get all the factor levels from the train data + traindata[[var]] <- factor(traindata[[var]]) + + # Ensure new data variable is a factor with the SAME levels (this is needed if the newdf is missing some categories) + newdf[[var]] <- factor(newdf[[var]], + levels = levels(traindata[[var]])) + } + + # Get the na.action argument + na.action.fun <- match.fun(na.action) + + # Use a dummy glm object with the correct formula and family + dummy_fit <- glm(model_formula, + data = traindata, + family = family_obj, + control = glm.control(maxit = 1)) + + # Change its coefficients with the correct ones + names(coefficients) <- names(dummy_fit$coefficients) + dummy_fit$coefficients <- coefficients + + # New predictions + prediction <- predict(dummy_fit, newdata = newdf, type = type, na.action = na.action.fun) + + return(prediction) +} + \ No newline at end of file diff --git a/R/roundDS.R b/R/roundDS.R new file mode 100644 index 00000000..6e0d0c10 --- /dev/null +++ b/R/roundDS.R @@ -0,0 +1,77 @@ +#' +#' @title roundDS +#' @description Generates objects from a server-side object, which can be either a vector or +#' a data-frame column. Supports five operations: +#' 1. (\code{round}) +#' 2. (\code{ceiling}) +#' 3. (\code{floor}) +#' 4. (\code{trunc}) +#' 5. (\code{signif}) +#' where each function in baseR is applied on the server side to the specified object. +#' +#' @details +#' Note: \code{add.column = TRUE} is only valid for data-frame inputs. +#' +#' +#' @param x Character vector specifying the server-side object(s). For data-frame columns, use the format \code{df$column}. +#' @param type Character string specifying the operation: \code{"round"}, \code{"ceiling"}, \code{"floor"}, +#' \code{trunc}, or \code{"signif"}. +#' @param digits Number of digits to be used in arguments \code{"round"} and \code{"signif"}. +#' @param add.column Logical. If \code{FALSE}, the result is created as a new server-side object; +#' if \code{TRUE}, the result is added as a new column in the existing data-frame. Default is \code{FALSE}. +#' @param newobj Character string for the name of the object that will be created on the server. Default is \code{"rounding.result"}. +#' +#' +#' @author Zulal Bekerecioglu +#' @return the created numeric vector or the updated dataframe with the added column +#' @export +#' +#' +roundDS <- function(x, type, digits, add.column, newobj) { + + # If x is NULL, throw and error. + if (is.null(x)) { + stop("Input object couldn't be found, please provide an object for rounding in the correct format. + For vectors, supply an existing object name; for columns, use the format dataframe$column, + where 'dataframe' is the name of the data frame and 'column' is the column name, + and ensure that both exist.", call. = FALSE) + } + + add.column <- as.logical(add.column) + + # Check if object is a column (contains $), if it is then save the dataframe name for later use if necessary + if(grepl("\\$", x)) { + is_column <- TRUE + dataframe_name <- strsplit(x, "\\$")[[1]][1] + column_name <- strsplit(x, "\\$")[[1]][2] + } else { + is_column <- FALSE + } + + + if(!is.null(x)&&!(is_column)) + { + object <- get(x) + + } else if(!is.null(x)&&is_column){ + df <- get(dataframe_name) + object <- df[[column_name]] + } + + result <- switch(type, + round = round(object, digits = digits), + ceiling = ceiling(object), + floor = floor(object), + trunc = trunc(object), + signif = signif(object, digits = digits)) + + if(!(is_column)){ # if the object was a numerical vector, save the result in a new object + return(result) + } else if((is_column)&&!add.column){ # if the object was a column and add.column is FALSE, save the result in a new object + return(result) + } else if((is_column)&&add.column){ # if the object was a column and add.column is TRUE, save the result as a column + df[[newobj]] <- result + return(df) + } + +} diff --git a/R/scaleDS.R b/R/scaleDS.R new file mode 100644 index 00000000..96cbd103 --- /dev/null +++ b/R/scaleDS.R @@ -0,0 +1,61 @@ +#' +#' @title scaleDS +#' @description Generates scaled objects using a server-side object, which can be either a vector or +#' a data-frame column. +#' +#' @details +#' Note: \code{add.column = TRUE} is only valid for data-frame inputs. +#' +#' +#' @param x Character string specifying the server-side vector For data-frame columns, use the format \code{df$column}. +#' @param newobj Character string for the name of the object that will be created on the server. Default is \code{"scaled.data"}. +#' @param add.column Logical. If \code{FALSE}, the result is created as a new server-side object; +#' if \code{TRUE}, the result is added as a new column in the existing data-frame. Default is \code{FALSE}. +#' +#' @author Zulal Bekerecioglu +#' @return the created numeric vector or the updated dataframe with the added column +#' @export +#' +#' +scaleDS <- function(x=NULL, newobj=NULL, add.column=NULL) { + + add.column <- as.logical(add.column) + + error_message <- "Input object couldn't found, please provide the correct format. For vectors, supply an existing object name; + for columns, use df$colname and ensure the dataframe and column exist." + + # If x is NULL, throw and error. + if (is.null(x)) { + stop(error_message, call. = FALSE) + } else { + is_dataframe <- grepl("\\$", x) + + if(is_dataframe) { + # Extract dataframe name + dataframe_name <- strsplit(x, "\\$")[[1]][1] + column_name <- strsplit(x, "\\$")[[1]][2] + + df <-get(dataframe_name) + } else { + + object <-get(x) + } + } + + + if(is_dataframe) { + result <- as.numeric(scale(df[[column_name]])) # scale the column + } else { + result <- as.numeric(scale(object)) # scale the vector + } + + # Return the dataframe with the added column, or the new object. + if(is_dataframe&&add.column) { + df[[newobj]] <- result + return(df) + } else { + return(result) + } + + +} From 95fd460da0813538f1b66bdf8f2b78f053a4dadb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Z=C3=BClal=20Bekerecio=C4=9Flu?= Date: Thu, 5 Feb 2026 12:43:50 +0100 Subject: [PATCH 18/24] Documentations for new implementations (date, predict, round, scale) --- DESCRIPTION | 2 +- NAMESPACE | 4 ++++ man/dateDS.Rd | 39 +++++++++++++++++++++++++++++++++++++++ man/predictDS.Rd | 43 +++++++++++++++++++++++++++++++++++++++++++ man/roundDS.Rd | 40 ++++++++++++++++++++++++++++++++++++++++ man/scaleDS.Rd | 29 +++++++++++++++++++++++++++++ 6 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 man/dateDS.Rd create mode 100644 man/predictDS.Rd create mode 100644 man/roundDS.Rd create mode 100644 man/scaleDS.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 31c7e951..84e31fa3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -62,5 +62,5 @@ Imports: tidyselect Suggests: testthat -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 Encoding: UTF-8 diff --git a/NAMESPACE b/NAMESPACE index 655cae99..2fc64481 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -36,6 +36,7 @@ export(dataFrameFillDS) export(dataFrameSortDS) export(dataFrameSubsetDS1) export(dataFrameSubsetDS2) +export(dateDS) export(densityGridDS) export(dimDS) export(dmtC2SDS) @@ -98,6 +99,7 @@ export(minMaxRandDS) export(namesDS) export(nsDS) export(numNaDS) +export(predictDS) export(qlsplineDS) export(quantileMeanDS) export(rBinomDS) @@ -117,8 +119,10 @@ export(recodeValuesDS) export(repDS) export(replaceNaDS) export(rmDS) +export(roundDS) export(rowColCalcDS) export(sampleDS) +export(scaleDS) export(scatterPlotDS) export(seqDS) export(setSeedDS) diff --git a/man/dateDS.Rd b/man/dateDS.Rd new file mode 100644 index 00000000..91546ab7 --- /dev/null +++ b/man/dateDS.Rd @@ -0,0 +1,39 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/dateDS.R +\name{dateDS} +\alias{dateDS} +\title{dateDS} +\usage{ +dateDS(x = NULL, type = NULL, newobj = NULL, unit = NULL, add.column = NULL) +} +\arguments{ +\item{x}{Character vector specifying the server-side object(s). For data-frame columns, use the format \code{df$column}.} + +\item{type}{Character string specifying the operation: \code{"extractdate"}, \code{"makedate"}, or \code{"timebetween"}.} + +\item{newobj}{Character string for the name of the object that will be created on the server. Default is \code{"date.result"}.} + +\item{unit}{Character string specifying the unit for \code{extractdate} or \code{timebetween}: \code{"days"}, \code{"months"}, or \code{"years"}.} + +\item{add.column}{Logical. If \code{FALSE}, the result is created as a new server-side object; +if \code{TRUE}, the result is added as a new column in the existing data-frame. Default is \code{FALSE}.} +} +\value{ +the created numeric vector or date object, or the updated dataframe with the added column +} +\description{ +Takes an object that is either a data-frame column or a vector, and can do extraction of +components of full date (\code{extractdate}), can combine date components to a full date (\code{makedate}), +or can calculate the time between two dates (\code{timebetween}). +} +\details{ +If the input is a data-frame column, it must be provided in the \code{x} argument as data-frame$column. +Inputs for \code{extractdate} and \code{timebetween} must be date objects. +For \code{makedate}, three numeric vectors (year, month, day) must be provided in the correct order. +The \code{add.column} argument determines whether the result is added as a new column in the existing +data-frame (\code{TRUE}), or created as a new server-side object (\code{FALSE}). +Note: \code{add.column = TRUE} is only valid for data-frame inputs. +} +\author{ +Zulal Bekerecioglu +} diff --git a/man/predictDS.Rd b/man/predictDS.Rd new file mode 100644 index 00000000..d795b422 --- /dev/null +++ b/man/predictDS.Rd @@ -0,0 +1,43 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/predictDS.R +\name{predictDS} +\alias{predictDS} +\title{predictDS} +\usage{ +predictDS( + newdataname, + traindataname, + type = c("response", "link"), + na.action = "na.pass" +) +} +\arguments{ +\item{newdataname}{A character string specifying the name of the new dataset to be used for predictions.} + +\item{traindataname}{A character string specifying the name of the dataset used for model training.} + +\item{type}{A character string specifying the type of prediction. Options are \code{"response"} or \code{"link"}.} + +\item{na.action}{A character string to specify the action to take if missing values are present. Default is \code{"na.pass"}.} +} +\value{ +a numeric vector containing the predicted values +} +\description{ +Generates server-side predictions using the client-side output from \code{ds.glm}. +} +\details{ +This function uses the components supplied by the client-side function (coefficients, family, formula, +and any categorical variables) to generate predictions on the server. To use the base R \code{predict()} function, +a "dummy" glm object is created using the same model formula, family, and link function as the original model. +The dummy model's coefficients are then replaced with the client-side coefficient estimates. + +To avoid mismatches between the factors used in the original glm and those in the dummy glm, the categorical +variables saved by the client-side function are applied to the newdata. + +For intercept-only models, the function simply returns a vector of predicted values equal to the model intercept, with the appropriate length +based on the row length of \code{newdataname}. +} +\author{ +Zulal Bekerecioglu +} diff --git a/man/roundDS.Rd b/man/roundDS.Rd new file mode 100644 index 00000000..00d0e106 --- /dev/null +++ b/man/roundDS.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/roundDS.R +\name{roundDS} +\alias{roundDS} +\title{roundDS} +\usage{ +roundDS(x, type, digits, add.column, newobj) +} +\arguments{ +\item{x}{Character vector specifying the server-side object(s). For data-frame columns, use the format \code{df$column}.} + +\item{type}{Character string specifying the operation: \code{"round"}, \code{"ceiling"}, \code{"floor"}, +\code{trunc}, or \code{"signif"}.} + +\item{digits}{Number of digits to be used in arguments \code{"round"} and \code{"signif"}.} + +\item{add.column}{Logical. If \code{FALSE}, the result is created as a new server-side object; +if \code{TRUE}, the result is added as a new column in the existing data-frame. Default is \code{FALSE}.} + +\item{newobj}{Character string for the name of the object that will be created on the server. Default is \code{"rounding.result"}.} +} +\value{ +the created numeric vector or the updated dataframe with the added column +} +\description{ +Generates objects from a server-side object, which can be either a vector or +a data-frame column. Supports five operations: +1. (\code{round}) +2. (\code{ceiling}) +3. (\code{floor}) +4. (\code{trunc}) +5. (\code{signif}) +where each function in baseR is applied on the server side to the specified object. +} +\details{ +Note: \code{add.column = TRUE} is only valid for data-frame inputs. +} +\author{ +Zulal Bekerecioglu +} diff --git a/man/scaleDS.Rd b/man/scaleDS.Rd new file mode 100644 index 00000000..a7ab4e25 --- /dev/null +++ b/man/scaleDS.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/scaleDS.R +\name{scaleDS} +\alias{scaleDS} +\title{scaleDS} +\usage{ +scaleDS(x = NULL, newobj = NULL, add.column = NULL) +} +\arguments{ +\item{x}{Character string specifying the server-side vector For data-frame columns, use the format \code{df$column}.} + +\item{newobj}{Character string for the name of the object that will be created on the server. Default is \code{"scaled.data"}.} + +\item{add.column}{Logical. If \code{FALSE}, the result is created as a new server-side object; +if \code{TRUE}, the result is added as a new column in the existing data-frame. Default is \code{FALSE}.} +} +\value{ +the created numeric vector or the updated dataframe with the added column +} +\description{ +Generates scaled objects using a server-side object, which can be either a vector or +a data-frame column. +} +\details{ +Note: \code{add.column = TRUE} is only valid for data-frame inputs. +} +\author{ +Zulal Bekerecioglu +} From c0ea1499417167c99f03eee1ea61ff1aaa2c5d4f Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Fri, 6 Feb 2026 13:37:26 +0000 Subject: [PATCH 19/24] Changes required to address devtools::check issues --- DESCRIPTION | 4 +++- R/dateDS.R | 23 +++++++++++------------ R/predictDS.R | 19 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 84e31fa3..bb70a19f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -59,7 +59,9 @@ Imports: childsds, purrr, tibble, - tidyselect + tidyselect, + stats, + lubridate Suggests: testthat RoxygenNote: 7.3.3 diff --git a/R/dateDS.R b/R/dateDS.R index ed54bf67..701db399 100644 --- a/R/dateDS.R +++ b/R/dateDS.R @@ -29,7 +29,6 @@ dateDS <- function(x=NULL, type=NULL, newobj=NULL, unit=NULL, add.column=NULL) { - library(lubridate) add.column <- as.logical(add.column) # If argument not in c("extractdate", "makedate", "timebetween") throw an error @@ -119,9 +118,9 @@ dateDS <- function(x=NULL, type=NULL, # Extract the requested component result <- switch(unit, - days = day(date_input), - months = month(date_input), - years = year(date_input), + days = lubridate::day(date_input), + months = lubridate::month(date_input), + years = lubridate::year(date_input), stop("Invalid unit. Must be one of: days, months, years")) } @@ -141,7 +140,7 @@ dateDS <- function(x=NULL, type=NULL, } if (any(year_vec < 1000 | year_vec > 3000, na.rm = TRUE)) { - stop("The 'year' input in 'makedate' must contain plausible 4-digit years (1000–3000). + stop("The 'year' input in 'makedate' must contain plausible 4-digit years (1000-3000). Check that year, month, and day are given in the correct order (year, month, day).", call. = FALSE) } if (any(month_vec < 1 | month_vec > 12, na.rm = TRUE)) { @@ -154,9 +153,9 @@ dateDS <- function(x=NULL, type=NULL, } - result <- make_date(year = year_vec, - month = month_vec, - day = day_vec) + result <- lubridate::make_date(year = year_vec, + month = month_vec, + day = day_vec) } @@ -166,12 +165,12 @@ dateDS <- function(x=NULL, type=NULL, # inputs[[1]] = start date, inputs[[2]] = end date units <- list( - years = years(1), - months = months(1), - days = days(1) + years = lubridate::years(1), + months = lubridate::month(1), + days = lubridate::days(1) ) - result <- interval(inputs[[1]], inputs[[2]]) %/% units[[unit]] + result <- lubridate::interval(inputs[[1]], inputs[[2]]) %/% units[[unit]] } # Save result based on add.column diff --git a/R/predictDS.R b/R/predictDS.R index e42c8beb..e3311f91 100644 --- a/R/predictDS.R +++ b/R/predictDS.R @@ -71,15 +71,15 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), # SPECIAL CASE HANDLING: y ~ 1, intercept only ###################### # A numeric vector will be created wit the mean, with the same length as the row number in newdataname - special_case <- length(attr(terms(formula(model_formula)), "term.labels")) == 0 + special_case <- length(attr(stats::terms(stats::formula(model_formula)), "term.labels")) == 0 if(special_case){ intercept <- coefficients # If the input is just a numeric vector, get the length - if(class(newdf)=="numeric"){ + if(all(c("numeric") %in% class(newdf))){ predictions.f <- rep(intercept, length(newdf)) - } else if(class(newdf)=="data.frame"){ + } else if(all(c("data.frame") %in% class(newdf))){ predictions.f <- rep(intercept, nrow(newdf)) # Otherwise use the number of rows } else { stop("Invalid input: The object called 'newdataname' must be either a numeric vector or a data.frame.",, call. = FALSE) @@ -95,7 +95,7 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), predictions.f <- exp(predictions.f) } else if (family_name == "binomial") { # logit - predictions.f <- plogis(predictions.f) + predictions.f <- stats::plogis(predictions.f) } else { stop("Unsupported family for intercept-only prediction: Family must be either Gaussian, Poisson, or Binomial.", call. = FALSE) } @@ -121,18 +121,17 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), na.action.fun <- match.fun(na.action) # Use a dummy glm object with the correct formula and family - dummy_fit <- glm(model_formula, - data = traindata, - family = family_obj, - control = glm.control(maxit = 1)) + dummy_fit <- stats::glm(model_formula, + data = traindata, + family = family_obj, + control = stats::glm.control(maxit = 1)) # Change its coefficients with the correct ones names(coefficients) <- names(dummy_fit$coefficients) dummy_fit$coefficients <- coefficients # New predictions - prediction <- predict(dummy_fit, newdata = newdf, type = type, na.action = na.action.fun) + prediction <- stats::predict(dummy_fit, newdata = newdf, type = type, na.action = na.action.fun) return(prediction) } - \ No newline at end of file From e35a0ae830b700123e7341ab4c4d5e87bc771eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Z=C3=BClal=20Bekerecio=C4=9Flu?= Date: Tue, 10 Feb 2026 09:41:58 +0100 Subject: [PATCH 20/24] Update files --- DESCRIPTION | 4 +++- R/dateDS.R | 23 +++++++++++------------ R/predictDS.R | 19 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 84e31fa3..bb70a19f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -59,7 +59,9 @@ Imports: childsds, purrr, tibble, - tidyselect + tidyselect, + stats, + lubridate Suggests: testthat RoxygenNote: 7.3.3 diff --git a/R/dateDS.R b/R/dateDS.R index ed54bf67..701db399 100644 --- a/R/dateDS.R +++ b/R/dateDS.R @@ -29,7 +29,6 @@ dateDS <- function(x=NULL, type=NULL, newobj=NULL, unit=NULL, add.column=NULL) { - library(lubridate) add.column <- as.logical(add.column) # If argument not in c("extractdate", "makedate", "timebetween") throw an error @@ -119,9 +118,9 @@ dateDS <- function(x=NULL, type=NULL, # Extract the requested component result <- switch(unit, - days = day(date_input), - months = month(date_input), - years = year(date_input), + days = lubridate::day(date_input), + months = lubridate::month(date_input), + years = lubridate::year(date_input), stop("Invalid unit. Must be one of: days, months, years")) } @@ -141,7 +140,7 @@ dateDS <- function(x=NULL, type=NULL, } if (any(year_vec < 1000 | year_vec > 3000, na.rm = TRUE)) { - stop("The 'year' input in 'makedate' must contain plausible 4-digit years (1000–3000). + stop("The 'year' input in 'makedate' must contain plausible 4-digit years (1000-3000). Check that year, month, and day are given in the correct order (year, month, day).", call. = FALSE) } if (any(month_vec < 1 | month_vec > 12, na.rm = TRUE)) { @@ -154,9 +153,9 @@ dateDS <- function(x=NULL, type=NULL, } - result <- make_date(year = year_vec, - month = month_vec, - day = day_vec) + result <- lubridate::make_date(year = year_vec, + month = month_vec, + day = day_vec) } @@ -166,12 +165,12 @@ dateDS <- function(x=NULL, type=NULL, # inputs[[1]] = start date, inputs[[2]] = end date units <- list( - years = years(1), - months = months(1), - days = days(1) + years = lubridate::years(1), + months = lubridate::month(1), + days = lubridate::days(1) ) - result <- interval(inputs[[1]], inputs[[2]]) %/% units[[unit]] + result <- lubridate::interval(inputs[[1]], inputs[[2]]) %/% units[[unit]] } # Save result based on add.column diff --git a/R/predictDS.R b/R/predictDS.R index e42c8beb..e3311f91 100644 --- a/R/predictDS.R +++ b/R/predictDS.R @@ -71,15 +71,15 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), # SPECIAL CASE HANDLING: y ~ 1, intercept only ###################### # A numeric vector will be created wit the mean, with the same length as the row number in newdataname - special_case <- length(attr(terms(formula(model_formula)), "term.labels")) == 0 + special_case <- length(attr(stats::terms(stats::formula(model_formula)), "term.labels")) == 0 if(special_case){ intercept <- coefficients # If the input is just a numeric vector, get the length - if(class(newdf)=="numeric"){ + if(all(c("numeric") %in% class(newdf))){ predictions.f <- rep(intercept, length(newdf)) - } else if(class(newdf)=="data.frame"){ + } else if(all(c("data.frame") %in% class(newdf))){ predictions.f <- rep(intercept, nrow(newdf)) # Otherwise use the number of rows } else { stop("Invalid input: The object called 'newdataname' must be either a numeric vector or a data.frame.",, call. = FALSE) @@ -95,7 +95,7 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), predictions.f <- exp(predictions.f) } else if (family_name == "binomial") { # logit - predictions.f <- plogis(predictions.f) + predictions.f <- stats::plogis(predictions.f) } else { stop("Unsupported family for intercept-only prediction: Family must be either Gaussian, Poisson, or Binomial.", call. = FALSE) } @@ -121,18 +121,17 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), na.action.fun <- match.fun(na.action) # Use a dummy glm object with the correct formula and family - dummy_fit <- glm(model_formula, - data = traindata, - family = family_obj, - control = glm.control(maxit = 1)) + dummy_fit <- stats::glm(model_formula, + data = traindata, + family = family_obj, + control = stats::glm.control(maxit = 1)) # Change its coefficients with the correct ones names(coefficients) <- names(dummy_fit$coefficients) dummy_fit$coefficients <- coefficients # New predictions - prediction <- predict(dummy_fit, newdata = newdf, type = type, na.action = na.action.fun) + prediction <- stats::predict(dummy_fit, newdata = newdf, type = type, na.action = na.action.fun) return(prediction) } - \ No newline at end of file From 03ca1cd02c9996fc7a4911b29dc533b54f1f77f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Z=C3=BClal=20Bekerecio=C4=9Flu?= Date: Tue, 10 Feb 2026 09:41:58 +0100 Subject: [PATCH 21/24] Update files --- DESCRIPTION | 4 +++- R/dateDS.R | 23 +++++++++++------------ R/predictDS.R | 19 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 84e31fa3..bb70a19f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -59,7 +59,9 @@ Imports: childsds, purrr, tibble, - tidyselect + tidyselect, + stats, + lubridate Suggests: testthat RoxygenNote: 7.3.3 diff --git a/R/dateDS.R b/R/dateDS.R index ed54bf67..68b6379a 100644 --- a/R/dateDS.R +++ b/R/dateDS.R @@ -29,7 +29,6 @@ dateDS <- function(x=NULL, type=NULL, newobj=NULL, unit=NULL, add.column=NULL) { - library(lubridate) add.column <- as.logical(add.column) # If argument not in c("extractdate", "makedate", "timebetween") throw an error @@ -119,9 +118,9 @@ dateDS <- function(x=NULL, type=NULL, # Extract the requested component result <- switch(unit, - days = day(date_input), - months = month(date_input), - years = year(date_input), + days = lubridate::day(date_input), + months = lubridate::month(date_input), + years = lubridate::year(date_input), stop("Invalid unit. Must be one of: days, months, years")) } @@ -141,7 +140,7 @@ dateDS <- function(x=NULL, type=NULL, } if (any(year_vec < 1000 | year_vec > 3000, na.rm = TRUE)) { - stop("The 'year' input in 'makedate' must contain plausible 4-digit years (1000–3000). + stop("The 'year' input in 'makedate' must contain plausible 4-digit years (1000-3000). Check that year, month, and day are given in the correct order (year, month, day).", call. = FALSE) } if (any(month_vec < 1 | month_vec > 12, na.rm = TRUE)) { @@ -154,9 +153,9 @@ dateDS <- function(x=NULL, type=NULL, } - result <- make_date(year = year_vec, - month = month_vec, - day = day_vec) + result <- lubridate::make_date(year = year_vec, + month = month_vec, + day = day_vec) } @@ -166,12 +165,12 @@ dateDS <- function(x=NULL, type=NULL, # inputs[[1]] = start date, inputs[[2]] = end date units <- list( - years = years(1), - months = months(1), - days = days(1) + years = lubridate::years(1), + months = lubridate::months(1), + days = lubridate::days(1) ) - result <- interval(inputs[[1]], inputs[[2]]) %/% units[[unit]] + result <- lubridate::interval(inputs[[1]], inputs[[2]]) %/% units[[unit]] } # Save result based on add.column diff --git a/R/predictDS.R b/R/predictDS.R index e42c8beb..e3311f91 100644 --- a/R/predictDS.R +++ b/R/predictDS.R @@ -71,15 +71,15 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), # SPECIAL CASE HANDLING: y ~ 1, intercept only ###################### # A numeric vector will be created wit the mean, with the same length as the row number in newdataname - special_case <- length(attr(terms(formula(model_formula)), "term.labels")) == 0 + special_case <- length(attr(stats::terms(stats::formula(model_formula)), "term.labels")) == 0 if(special_case){ intercept <- coefficients # If the input is just a numeric vector, get the length - if(class(newdf)=="numeric"){ + if(all(c("numeric") %in% class(newdf))){ predictions.f <- rep(intercept, length(newdf)) - } else if(class(newdf)=="data.frame"){ + } else if(all(c("data.frame") %in% class(newdf))){ predictions.f <- rep(intercept, nrow(newdf)) # Otherwise use the number of rows } else { stop("Invalid input: The object called 'newdataname' must be either a numeric vector or a data.frame.",, call. = FALSE) @@ -95,7 +95,7 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), predictions.f <- exp(predictions.f) } else if (family_name == "binomial") { # logit - predictions.f <- plogis(predictions.f) + predictions.f <- stats::plogis(predictions.f) } else { stop("Unsupported family for intercept-only prediction: Family must be either Gaussian, Poisson, or Binomial.", call. = FALSE) } @@ -121,18 +121,17 @@ predictDS <- function(newdataname, traindataname, type = c("response", "link"), na.action.fun <- match.fun(na.action) # Use a dummy glm object with the correct formula and family - dummy_fit <- glm(model_formula, - data = traindata, - family = family_obj, - control = glm.control(maxit = 1)) + dummy_fit <- stats::glm(model_formula, + data = traindata, + family = family_obj, + control = stats::glm.control(maxit = 1)) # Change its coefficients with the correct ones names(coefficients) <- names(dummy_fit$coefficients) dummy_fit$coefficients <- coefficients # New predictions - prediction <- predict(dummy_fit, newdata = newdf, type = type, na.action = na.action.fun) + prediction <- stats::predict(dummy_fit, newdata = newdf, type = type, na.action = na.action.fun) return(prediction) } - \ No newline at end of file From 0db81a01945beedb2e86a28dbb341c5bf9761ceb Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Tue, 10 Feb 2026 15:21:16 +0000 Subject: [PATCH 22/24] Updates needed to pass 'devtools' --- DESCRIPTION | 3 +-- R/global.R | 3 ++- azure-pipelines.yml | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f37bbbca..d266f6e0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -74,8 +74,7 @@ Imports: childsds, purrr, tibble, - tidyselect, - tidytable + tidyselect Suggests: spelling, testthat diff --git a/R/global.R b/R/global.R index a3c9454e..f4402723 100644 --- a/R/global.R +++ b/R/global.R @@ -2,4 +2,5 @@ utils::globalVariables(c('offset.to.use', 'weights.to.use', 'out.table.real', 'out.table.dim', 'out.table.dimnames', 'list.obj', 'mg', 'blackbox.output.df', 'blackbox.ranks.df', 'global.bounds.df', 'global.ranks.quantiles.df', 'sR4.df', - 'min.max.df','sR5.df','input.mean.sd.df','input.ranks.sd.df','RS','CG','mixed','x','y','.old_seed','.Random.seed')) + 'min.max.df','sR5.df','input.mean.sd.df','input.ranks.sd.df','RS','CG','mixed','x','y','.old_seed','.Random.seed', + 'subsetByClassHelper1', 'subsetByClassHelper2', 'subsetByClassHelper3')) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b79d39f0..b809dd0c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -124,7 +124,6 @@ jobs: sudo R -e "install.packages('purrr', dependencies=TRUE)" sudo R -e "install.packages('tibble', dependencies=TRUE)" sudo R -e "install.packages('tidyselect', dependencies=TRUE)" - sudo R -e "install.packages('tidytable', dependencies=TRUE)" displayName: 'Install all dependencies for dsBase' condition: succeeded() From 8bd45f9ac648ed58294f65708ba97dba3fe0b387 Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Tue, 10 Feb 2026 16:55:37 +0000 Subject: [PATCH 23/24] Further issue fixes --- DESCRIPTION | 3 +- azure-pipelines.yml | 1 + tests/testthat/test-smk-asDataMatrixDS.R | 57 +++++++++++++++++------ tests/testthat/test-smk-standardiseDfDS.R | 2 +- 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d266f6e0..3f553102 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -77,7 +77,8 @@ Imports: tidyselect Suggests: spelling, - testthat + testthat, + tidytable RoxygenNote: 7.3.3 Encoding: UTF-8 Language: en-GB diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b809dd0c..b79d39f0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -124,6 +124,7 @@ jobs: sudo R -e "install.packages('purrr', dependencies=TRUE)" sudo R -e "install.packages('tibble', dependencies=TRUE)" sudo R -e "install.packages('tidyselect', dependencies=TRUE)" + sudo R -e "install.packages('tidytable', dependencies=TRUE)" displayName: 'Install all dependencies for dsBase' condition: succeeded() diff --git a/tests/testthat/test-smk-asDataMatrixDS.R b/tests/testthat/test-smk-asDataMatrixDS.R index 6c4f567c..cfcd5f2f 100644 --- a/tests/testthat/test-smk-asDataMatrixDS.R +++ b/tests/testthat/test-smk-asDataMatrixDS.R @@ -1,5 +1,6 @@ #------------------------------------------------------------------------------- # Copyright (c) 2019-2022 University of Newcastle upon Tyne. All rights reserved. +# Copyright (c) 2026 Arjuna Technologies, Newcastle upon Tyne. All rights reserved. # # This program and the accompanying materials # are made available under the terms of the GNU Public License v3.0. @@ -29,25 +30,53 @@ test_that("simple asDataMatrixDS", { { expect_length(res.class, 1) expect_true("matrix" %in% res.class) + + expect_length(res, 10) + expect_equal(res[1], 0) + expect_equal(res[2], 1) + expect_equal(res[3], 2) + expect_equal(res[4], 3) + expect_equal(res[5], 4) + expect_equal(res[6], 4) + expect_equal(res[7], 3) + expect_equal(res[8], 2) + expect_equal(res[9], 1) + expect_equal(res[10], 0) } - else + else if (base::getRversion() < '4.0.1') { expect_length(res.class, 2) - expect_true("matrix" %in% res.class) - expect_true("array" %in% res.class) + expect_true(all(c("matrix", "array") %in% res.class)) + + expect_length(res, 10) + expect_equal(res[1], 0) + expect_equal(res[2], 1) + expect_equal(res[3], 2) + expect_equal(res[4], 3) + expect_equal(res[5], 4) + expect_equal(res[6], 4) + expect_equal(res[7], 3) + expect_equal(res[8], 2) + expect_equal(res[9], 1) + expect_equal(res[10], 0) } + else + { + expect_length(res.class, 1) + expect_true(all("data.frame" %in% res.class)) - expect_length(res, 10) - expect_equal(res[1], 0) - expect_equal(res[2], 1) - expect_equal(res[3], 2) - expect_equal(res[4], 3) - expect_equal(res[5], 4) - expect_equal(res[6], 4) - expect_equal(res[7], 3) - expect_equal(res[8], 2) - expect_equal(res[9], 1) - expect_equal(res[10], 0) + expect_length(res, 2) + expect_equal(res[1, 1], 0) + expect_equal(res[2, 1], 1) + expect_equal(res[3, 1], 2) + expect_equal(res[4, 1], 3) + expect_equal(res[5, 1], 4) + expect_equal(res[1, 2], 4) + expect_equal(res[2, 2], 3) + expect_equal(res[3, 2], 2) + expect_equal(res[4, 2], 1) + expect_equal(res[5, 2], 0) + } res.colnames <- colnames(res) expect_length(res.colnames, 2) diff --git a/tests/testthat/test-smk-standardiseDfDS.R b/tests/testthat/test-smk-standardiseDfDS.R index 64c7ba4d..1bfd6720 100644 --- a/tests/testthat/test-smk-standardiseDfDS.R +++ b/tests/testthat/test-smk-standardiseDfDS.R @@ -49,7 +49,7 @@ test_that("fixClassDS sets classes correctly", { ) expect_equal( - classes_changed_df %>% map_chr(class) %>% unname(), + classes_changed_df %>% tidytable::map_chr(class) %>% unname(), c("factor", "factor", "numeric", "factor", "factor", "factor", "factor", "integer", "factor", "factor", "factor", "factor", "character", "logical", "factor", "integer", "integer", "numeric", "logical", "integer", "character", "numeric", "numeric", "character", "numeric", From 1789c99a19480fb8b202f1a65c6c79a79c68214f Mon Sep 17 00:00:00 2001 From: Stuart Wheater Date: Fri, 12 Jun 2026 16:15:34 +0100 Subject: [PATCH 24/24] Updated RoxygenNote to 8.0.0 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 77954f4a..a9573b74 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -81,6 +81,6 @@ Suggests: spelling, testthat, tidytable -RoxygenNote: 7.3.3 +RoxygenNote: 8.0.0 Encoding: UTF-8 Language: en-GB