ds.mean {dsBaseClient}R Documentation

Computes the statistical mean of a given vector

Description

This function is similar to the R function mean.

Usage

ds.mean(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 mean is calculated if type is set to 'split', the mean 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 data frame, from opal datasources.

Details

It is a wrapper for the server side function.

Value

a numeric

Author(s)

Gaye A., Isaeva I.

See Also

ds.quantileMean to compute quantiles.

ds.summary to generate the summary of a variable.

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 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 dsBaseClient version 4.1.0 ]