ds.exists {dsBaseClient}R Documentation

Checks if an object is defined on the server side

Description

this function is similar to R function exists

Usage

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

Arguments

x

a character, the name of the object to look for.

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

In DataSHIELD it is not possible to see the data sitting on the servers of the collaborating studies. It is only possible to get summaries of objects stored on the server side. It is however important to know if an object is defined (i.e. exists) son the server side. This function checks if an object do really exists on the server side. Further information about the object can be obtained using functions such as ds.class, length etc...

Value

a boolean, TRUE if the object is on the server side and FALSE otherwise

Author(s)

Gaye, A.

See Also

ds.class to check the type of an object.

Examples

{

  # load the file that contains the login details
  data(logindata)

  # login and assign the required variables to R
  myvar <- list("LAB_TSC")
  opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar)

  # assign 'LAB_TSC' in the dataframe D to a new variable 'labtsc'
  ds.assign(toAssign='D$LAB_TSC', newobj='labtsc')

  # now let us check if the variable 'labtsc' does now 'exist' on the server side
  ds.exists(x='labtsc')

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

}

[Package dsBaseClient version 4.1.0 ]