Learn R Programming

dsBase: 'DataSHIELD' Server Side Base Functions

Installation

You can install the released version of dsBase from CRAN with:

install.packages("dsBase")

And the development version from GitHub with:

install.packages("remotes")
remotes::install_github("datashield/dsBase", "<BRANCH>")

# Install v6.3.4 with the following
remotes::install_github("datashield/dsBase", "6.3.4")

For a full list of development branches, checkout https://github.com/datashield/dsBase/branches

About

DataSHIELD is a software package which allows you to do non-disclosive federated analysis on sensitive data. Our website (https://www.datashield.org) has in depth descriptions of what it is, how it works and how to install it. A key point to highlight is that DataSHIELD has a client-server infrastructure, so the dsBase package (https://github.com/datashield/dsBase) needs to be used in conjunction with the dsBaseClient package (https://github.com/datashield/dsBaseClient) - trying to use one without the other makes no sense.

Detailed instructions on how to install DataSHIELD are at https://wiki.datashield.org/. The code here is organised as:

LocationWhat is it?
obiba CRANWhere you probably should install DataSHIELD from.
releasesStable releases.
master branchMostly in sync with the latest release, changes rarely.

References

[1] Burton P, Wilson R, Butters O, Ryser-Welch P, Westerberg A, Abarrategui L, Villegas-Diaz R, Avraam D, Marcon Y, Bishop T, Gaye A, Escribà Montagut X, Wheater S (2025). dsBase: 'DataSHIELD' Server Side Base Functions. R package version 6.3.4. https://doi.org/10.32614/CRAN.package.dsBase.

[2] Gaye A, Marcon Y, Isaeva J, LaFlamme P, Turner A, Jones E, Minion J, Boyd A, Newby C, Nuotio M, Wilson R, Butters O, Murtagh B, Demir I, Doiron D, Giepmans L, Wallace S, Budin-Ljøsne I, Oliver Schmidt C, Boffetta P, Boniol M, Bota M, Carter K, deKlerk N, Dibben C, Francis R, Hiekkalinna T, Hveem K, Kvaløy K, Millar S, Perry I, Peters A, Phillips C, Popham F, Raab G, Reischl E, Sheehan N, Waldenberger M, Perola M, van den Heuvel E, Macleod J, Knoppers B, Stolk R, Fortier I, Harris J, Woffenbuttel B, Murtagh M, Ferretti V, Burton P (2014). “DataSHIELD: taking the analysis to the data, not the data to the analysis.” International Journal of Epidemiology, 43(6), 1929-1944. https://doi.org/10.1093/ije/dyu188.

[3] Wilson R, W. Butters O, Avraam D, Baker J, Tedds J, Turner A, Murtagh M, R. Burton P (2017). “DataSHIELD – New Directions and Dimensions.” Data Science Journal, 16(21), 1-21. https://doi.org/10.5334/dsj-2017-021.

[4] Avraam D, Wilson R, Aguirre Chan N, Banerjee S, Bishop T, Butters O, Cadman T, Cederkvist L, Duijts L, Escribà Montagut X, Garner H, Gonçalves G, González J, Haakma S, Hartlev M, Hasenauer J, Huth M, Hyde E, Jaddoe V, Marcon Y, Mayrhofer M, Molnar-Gabor F, Morgan A, Murtagh M, Nestor M, Nybo Andersen A, Parker S, Pinot de Moira A, Schwarz F, Strandberg-Larsen K, Swertz M, Welten M, Wheater S, Burton P (2024). “DataSHIELD: mitigating disclosure risk in a multi-site federated analysis platform.” Bioinformatics Advances, 5(1), 1-21. https://doi.org/10.1093/bioadv/vbaf046.

Note: Apple Mx architecture users, please be aware that there are some numerical limitations on this platform, which leads to unexpected results when using base R packages, like stats​.

x <- c(0, 3, 7)

1 - cor(x, x)​

The above should result in a value of zero.

Also See: For more details see https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f and the bug report: https://bugs.r-project.org/show_bug.cgi?id=18941

Copy Link

Version

Install

install.packages('dsBase')

Monthly Downloads

267

Version

6.3.4

License

GPL-3

Maintainer

Stuart Wheater

Last Published

September 18th, 2025

Functions in dsBase (6.3.4)

checkNegValueDS

Checks if a numeric variable has negative values
colnamesDS

Returns the column names of a data frame or matrix
classDS

Returns the class of an object
changeRefGroupDS

Changes a reference level of a factor
covDS

Computes the sum of each variable and the sum of products for each pair of variables
corDS

Computes the sum of each variable and the sum of products for each pair of variables
elsplineDS

Basis for a piecewise linear spline with meaningful coefficients
dimDS

Returns the dimension of a data frame or matrix
densityGridDS

Generates a density grid with or without a priori defined limits
dataFrameSubsetDS1

dataFrameSubsetDS1 an aggregate function called by ds.dataFrameSubset
dataFrameSortDS

Sorting and reordering data frames, vectors or matrices
dataFrameSubsetDS2

dataFrameSubsetDS2 an assign function called by ds.dataFrameSubset
dsBase-package

dsBase: 'DataSHIELD' Server Side Base Functions
dataFrameFillDS

dataFrameFillDS
dataFrameDS

dataFrameDS called by ds.dataFrame
dmtC2SDS

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

glmDS1 called by ds.glm
extractQuantilesDS1

Secure ranking of "V2BR" (vector to be ranked) across all sources and use of these ranks to estimate global quantiles across all studies
gamlssDS

gamlssDS an aggregate function called by ds.gamlss
glmDS2

glmDS2 called by ds.glm
glmPredictDS.as

predict regression responses from a glm object
glmSLMADS1

Fit a Generalized Linear Model (GLM) with pooling via Study Level Meta-Analysis (SLMA)
glmPredictDS.ag

predict regression responses from a glm object
extractQuantilesDS2

Secure ranking of "V2BR" (vector to be ranked) across all sources and use of these ranks to estimate global quantiles across all studies
glmSLMADS.assign

Fit a Generalized Linear Model (GLM) with pooling via Study Level Meta-Analysis (SLMA)
getWGSRDS

Computes the WHO Growth Reference z-scores of anthropometric data
glmerSLMADS2

Fitting generalized linear mixed effect models - serverside function
histogramDS1

returns the minimum and the maximum of the input numeric vector
histogramDS2

Computes a histogram of the input variable without plotting.
glmerSLMADS.assign

Fitting generalized linear mixed effect models - serverside function
glmSLMADS2

Fit a Generalized Linear Model (GLM) with pooling via Study Level Meta-Analysis (SLMA)
hetcorDS

Heterogeneous Correlation Matrix
igb_standardsDS

Converts birth measurements to intergrowth z-scores/centiles
glmSummaryDS.as

summarize a glm object on the serverside
glmSummaryDS.ag

summarize a glm object on the serverside
heatmapPlotDS

Calculates the coordinates of the centroid of each n nearest neighbours
isNaDS

Checks if a vector is empty
lengthDS

Returns the length of a vector or list
levelsDS

Returns the levels of a factor vector
listDS

Coerce objects into a list
lexisDS1

lexisDS1
lexisDS3

@title lexisDS3
kurtosisDS2

Calculates the kurtosis of a numeric variable
kurtosisDS1

Calculates the kurtosis of a numeric variable
lexisDS2

lexisDS2
isValidDS

Checks if an input is valid
lmerSLMADS.assign

Fitting linear mixed effect models - serverside function
matrixDimnamesDS

matrixDimnamesDS assign function called by ds.matrixDimnames
listDisclosureSettingsDS

listDisclosureSettingsDS
lsDS

lists all objects on a serverside environment
matrixDetDS2

matrixDetDS assign function called by ds.matrixDet
matrixDiagDS

matrixDiagDS assign function called by ds.matrixDiag
matrixDS

matrixDS assign function called by ds.matrix
lsplineDS

Basis for a piecewise linear spline with meaningful coefficients
lmerSLMADS2

Fitting linear mixed effect models - serverside function
miceDS

Aggregate function called by ds.mice
matrixInvertDS

matrixInvertDS serverside assign function called by ds.matrixInvert
meanSdGpDS

MeanSdGpDS
minMaxRandDS

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

matrixDetDS aggregate function called by ds.matrixDet.report
meanDS

Computes statistical mean of a vector
metadataDS

Returns the metadata, if any, about the specified variable
messageDS

messageDS
mergeDS

mergeDS (assign function) called by ds.merge
matrixTransposeDS

matrixTransposeDS serverside assign function called by ds.matrixTranspose
matrixMultDS

matrixMultDS serverside assign function called by ds.matrixMult
rNormDS

rNormDS serverside assign function
rBinomDS

rBinomDS serverside assign function
quantileMeanDS

Generates quantiles and mean information without maximum and minimum
rPoisDS

rPoisDS serverside assign function
qlsplineDS

Basis for a piecewise linear spline with meaningful coefficients
rUnifDS

rUnifDS serverside assign function
numNaDS

Counts the number of missing values
namesDS

Return the names of a list object
nsDS

Generate a Basis Matrix for Natural Cubic Splines
rangeDS

returns the minimum and maximum of a numeric vector
recodeLevelsDS

Recodes the levels of a categorical variables
ranksSecureDS3

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

repDS called by ds.rep
ranksSecureDS4

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

reShapeDS (assign function) called by ds.reShape
rbindDS

rbindDS called by ds.rbind
ranksSecureDS1

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

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

recodeValuesDS an assign function called by ds.recodeValues
ranksSecureDS2

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

Calculates the coordinates of the data to be plot
sampleDS

random sampling and permuting of vectors, dataframes and matrices
rowColCalcDS

Computes sums and means of rows or columns of numeric arrays
rmDS

rmDS an aggregate function called by ds.rm
replaceNaDS

Replaces the missing values in a vector
skewnessDS1

Calculates the skewness of a numeric variable
seqDS

seqDS a serverside assign function called by ds.seq
setSeedDS

setSeedDs called by ds.setSeed, ds.rNorm, ds.rUnif, ds.rPois and ds.rBinom
skewnessDS2

Calculates the skewness of a numeric variable
sqrtDS

Computes the square root values of the input variable
table2DDS

table2DDS (aggregate function) called by ds.table2D
tapplyDS.assign

tapplyDS.assign called by ds.tapply.assign
tableDS.assign

tableDS.assign is the serverside assign function called by ds.table
table1DDS

Creates 1-dimensional contingency tables
tableDS

tableDS is the first of two serverside aggregate functions called by ds.table
testObjExistsDS

testObjExistsDS
subsetByClassDS

Breaks down a dataframe or a factor into its sub-classes
subsetDS

Generates a valid subset of a table or a vector
uniqueDS

Applies the unique method to a server-side variable.
unListDS

unListDS a serverside assign function called by ds.unList
tapplyDS

tapplyDS called by ds.tapply
tableDS2

tableDS is the second of two serverside aggregate functions called by ds.table
vectorDS

Creates a vector on the server-side.
varDS

Computes the variance of vector
asFactorDS1

Determines the levels of the input variable in each single study
asListDS

asListDS a serverside aggregate function called by ds.asList
asFactorSimpleDS

Converts a numeric vector into a factor
asCharacterDS

Coerces an R object into class character
asFactorDS2

Converts a numeric vector into a factor
BooleDS

BooleDS
asDataMatrixDS

asDataMatrixDS a serverside assign function called by ds.asDataMatrix
absDS

Computes the absolute values of the input variable
asIntegerDS

Coerces an R object into class integer
asLogicalDS

Coerces an R object into class numeric
boxPlotGG_data_TreatmentDS

Arrange data frame to pass it to the boxplot function
asMatrixDS

Coerces an R object into a matrix
boxPlotGGDS

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

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

aucDS an aggregate function called by ds.auc
boxPlotGG_data_Treatment_numericDS

Arrange vector to pass it to the boxplot function
asNumericDS

Coerces an R object into class numeric
blackBoxDS

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

Concatenates objects into a vector or list
bp_standardsDS

Calculates Blood pressure z-scores
checkPermissivePrivacyControlLevel

checkPermissivePrivacyControlLevel
completeCasesDS

completeCasesDS: an assign function called by ds.completeCases
corTestDS

Tests for correlation between paired samples
cbindDS

cbindDS called by ds.cbind