ds.levels {dsBaseClient}R Documentation

Returns the levels attribute of a factor

Description

This function is similar to R function levels

Usage

ds.levels(x = NULL, datasources = NULL)

Arguments

x

a character, the name of a factor variable

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

This is just a wrapper function for the server side function.

Value

levels of x

Author(s)

Gaye, A.; Isaeva, J.

Examples

{

  # load that contains the login details
  data(logindata)

  # login
  opals <- datashield.login(logins=logindata,assign=TRUE)

  # Example 1: Get the levels of the PM_BMI_CATEGORICAL variable
  ds.levels(x='D$PM_BMI_CATEGORICAL')

  # Example 2: Get the levels of the LAB_TSC   SHOULD NOT WORK AS IT IS A CONTINUOUS VARIABLE
  ## Not run:  ds.levels(x='D$LAB_TSC') 

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

}

[Package dsBaseClient version 4.1.0 ]