ds.var: Computes the variance of a given vector

Description Usage Arguments Details Value Author(s) Examples

Description

This function is similar to the R function var.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{

  # 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)

}

datashield/dsStatsClient documentation built on May 14, 2019, 7:52 p.m.