ds.var {dsBaseClient}R Documentation

ds.var calling aggregate function varDS


Computes the variance of a given vector This function is similar to the R function var.


ds.var(x = NULL, type = "split", checks = FALSE,
  datasources = NULL)



a character, 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 variance is calculated if type is set to 'split', 'splits' or 's', the variance 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 list of opal object(s) obtained after login in to opal servers; these objects hold also the data assign to R, as dataframe, from opal datasources.


It is a wrapper for the server side function. The server side function returns 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 lenght of the variable, and a study message indicating whether the number of valid is less than the disclosure threshold. The variance is calculated at the client side by the formula $




a list including: Variance.by.Study = estimated variance 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.Variance = Variance, 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.


Amadou Gaye, Demetris Avraam, for DataSHIELD Development Team


## Not run: 

  # load that contains the login details

  # login and assign specific variable(s)
  myvar <- list('LAB_TSC')
  opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar)

  # Example 1: compute the pooled variance of the variable 'LAB_TSC' - default behaviour

  # Example 2: compute the variance of each study separately
  ds.var(x='D$LAB_TSC', type='split')

  # clear the Datashield R sessions and logout

## End(Not run)

[Package dsBaseClient version 5.0.0 ]