ds.isValid {dsBaseClient}R Documentation

Checks if an object is valid

Description

Checks if a vector or table structure has a number of observations equal to or greater than the threshold set by DataSHIELD.

Usage

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

Arguments

x

a character, the name of a vector, dataframe or matrix.

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. By default an internal function looks for 'opal' objects in the environment and sets this parameter.

Details

In DataSHIELD, analyses are possible only on valid objects to ensure the ouput is not disclosive. This function checks if an input object is valid. A vector is valid if the number of observations are equal to or greater than a set threshold. A factor vector is valid if all its levels (categories) have a count equal or greater than the set threshold. A dataframe or a matrix is valid if the number of rows is equal or greater than the set threshold.

Value

a boolean, TRUE if input object is valid and FALSE otherwise.

Author(s)

Gaye, A.

Examples

{

  # load that contains the login details
  data(logindata)

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

  # Example 1: Check if the dataframe assigned above is valid
  ds.isValid(x='D')

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

}

[Package dsBaseClient version 4.1.0 ]