ds.asList {dsBaseClient}R Documentation

Constructs an object of type list


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


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



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


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'


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.


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)).


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


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.



  # load that contains the login details

  # 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

  # clear the Datashield R sessions and logout


[Package dsBaseClient version 4.1.0 ]