ds.asList {dsBaseClient}R Documentation

Constructs an object of type list

Description

This function is similar to R function as.list with some restrictions.

Usage

ds.asList(x = NULL, newobj = NULL, datasources = NULL)

Arguments

x

a character, the name of the object to convert into a list

newobj

the name of the new vector.If this argument is set to NULL, the name of the new variable is the name of the input variable with the suffixe '_list'

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

Unlike the R function 'as.list' only certain object types (data.frame, matrix) can be turned into a list, this is because turning a single vector into a list produces a list where each element holds one value only. A matrix is turned into data.frame before being converted into a list. When a data.frame, matrix is turned into a list the output list is allowed only if the number of rows of the input data.frame or matrix is greater than the allowed number of observations. Otherwise a list missing at complete is generated (i.e. all elements set to NA)).

Value

nothing is returned to the client, the new object is stored on the server side.

Author(s)

Gaye, A.; Isaeva, J.

See Also

ds.asNumeric to turn a variable into a numeric type.

ds.asFactor to turn a variable into a factor type.

ds.asCharacter to turn a variable into a character type.

ds.asMatrix to coerce an object into a matrix type.

Examples

{

  # load that contains the login details
  data(logindata)

  # login and assign all the stored variable(s)
  # (by default the assigned dataset is a dataframe named 'D')
  opals <- datashield.login(logins=logindata,assign=TRUE)

  # turn the dataframe 'D' (the default name of the dataframe assign above) into a list
  ds.asList(x='D')

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

}

[Package dsBaseClient version 4.1.0 ]