ds.isNA {dsBaseClient}R Documentation

Checks if a vector is empty

Description

this function is similar to R function is.na but instead of a vector of booleans it returns just one boolean to tell if all the elements are missing values.

Usage

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

Arguments

x

a character, the name of the vector to check.

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 certain analyses such as GLM none of the variable should be missing at complete (i.e. missing value for each observation). Since in DataSHIELD it is not possible to see the data it is important to know whether or not a vector is empty to proceed accordingly.

Value

a boolean 'TRUE' if the vector is empty (all values are 'NA') and 'FALSE' otherwise.

Author(s)

Gaye, A.

Examples

{

  # load the login data
  data(logindata)

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

  # check if all the observation of the variable 'LAB_HDL' are missing (NA)
  ds.isNA(x='D$LAB_HDL')

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

}

[Package dsBaseClient version 4.1.0 ]