ds.var {dsStatsClient}R Documentation

Computes the variance of a given vector

Description

This function is similar to the R function var.

Usage

ds.var(x = NULL, type = "combine", datasources = NULL)

Arguments

x

a character, the name of a numerical vector.

type

a character which represents the type of analysis to carry out. If type is set to 'combine', a global variance is calculated if type is set to 'split', the variance is calculated separately for each study.

datasources

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.

Details

It is a wrapper for the server side function

Value

a a global variance or one variance for each study.

Author(s)

Gaye, A.

Examples

{

  # load that contains the login details
  data(logindata)

  # 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
  ds.var(x='D$LAB_TSC')

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

  # clear the Datashield R sessions and logout
  datashield.logout(opals)

}

[Package dsStatsClient version 4.1.0 ]