ds.cbind {dsBaseClient}R Documentation

Combines objects by columns

Description

This is similar to the R base function cbind with the only differences that it allows to combine up to 5 objects (vectors and/or table structures).

Usage

ds.cbind(x = NULL, newobj = "newCbindObject", datasources = NULL)

Arguments

x

a character vector, the name of the vector and or table to combine by column.

newobj

the name of the output object. If this argument is set to NULL, the name of the new object is 'newCbindObject'.

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

see details of the R base function cbind.

Value

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

Author(s)

Gaye, A.

See Also

ds.dataframe to generate a table of type dataframe.

ds.changeRefGroup to change the reference level of a factor.

ds.colnames to obtain the column names of a matrix or a data frame

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

ds.dim to obtain the dimensions of matrix or a data frame.

Examples

{

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

  # login and assign specific variables(s)
  # (by default the assigned dataset is a dataframe named 'D')
  myvar <- list('LAB_TSC', 'LAB_HDL')
  opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar)

  # generate a new dataframe by combining the log values of
  # 'LAB_TSC' and 'LAB_HDL', by columns
  ds.assign(toAssign='log(D$LAB_TSC)', newobj='labtsc')
  ds.assign(toAssign='log(D$LAB_HDL)', newobj='labhdl')
  ds.cbind(x=c('labtsc','labhdl'), newobj="myDataframe")

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

}

[Package dsBaseClient version 4.1.0 ]