ds.mean.o {dsBetaTestClient}R Documentation

Computes the statistical mean of a given vector


This function is similar to the R function mean.


ds.mean.o(x = NULL, type = "split", checks = FALSE,
  save.mean.Nvalid = FALSE, datasources = NULL)



a character, typically the name of a numerical vector


a character which represents the type of analysis to carry out. If type is set to 'combine', 'combined', 'combines' or 'c', a global mean is calculated if type is set to 'split', 'splits' or 's', the mean is calculated separately for each study. if type is set to 'both' or 'b', both sets of outputs are produced


a Boolean indicator of whether to undertake optional checks of model components. Defaults to checks=FALSE to save time. It is suggested that checks should only be undertaken once the function call has failed


a Boolean indicator of whether the user wishes to save the generated values of the mean and of the number of valid (non-missing) observations into the R environments at each of the data servers. Will save study-specific means and Nvalids as well as the global equivalents across all studies combined. Once the estimated means and Nvalids are written into the server-side R environments, they can be used directly to centralize the variable of interest around its global mean or its study-specific means. Finally, the isDefined internal function checks whether the key variables have been created.


specifies the particular opal object(s) to use, if it is not specified the default set of opals will be used. The default opals are always called default.opals. This parameter is set without inverted commas: e.g. datasources=opals.em or datasources=default.opals If you wish to specify the second opal server in a set of three, the parameter is specified: e.g. datasources=opals.em[2]. If you wish to specify the first and third opal servers in a set specify: e.g. datasources=opals.em[2,3]


It is a wrapper for the server side function.


a list including: Mean.by.Study = estimated mean in each study separately (if type = split or both), with Nmissing (number of missing observations), Nvalid (number of valid observations), Ntotal (sum of missing and valid observations) also reported separately for each study; Global.Mean = Mean, Nmissing, Nvalid, Ntotal across all studies combined (if type = combine or both); Nstudies = number of studies being analysed; ValidityMessage indicates whether a full analysis was possible or whether one or more studies had fewer valid observations than the nfilter threshold for the minimum cell size in a contingency table. If save.mean.Nvalid=TRUE, ds.mean.o writes the objects "Nvalid.all.studies", "Nvalid.study.specific", "mean.all.studies", and "mean.study.specific" to the serverside on each server


Burton PR; Gaye A; Isaeva I;

See Also

ds.quantileMean to compute quantiles.

ds.summary to generate the summary of a variable.



#  # load that contains the login details
#  data(logindata)
#  library(opal)
#  # login and assign specific variable(s)
#  myvar <- list('LAB_TSC')
#  opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar)
#  # Example 1: compute the pooled statistical mean of the variable 'LAB_TSC' - default behaviour
#  ds.mean(x='D$LAB_TSC')
#  # Example 2: compute the statistical mean of each study separately
#  ds.mean(x='D$LAB_TSC', type='split')
#  # clear the Datashield R sessions and logout
#  datashield.logout(opals)


[Package dsBetaTestClient version 0.2.0 ]