Learn R Programming

opalr (version 3.3.1)

opal.assign.table: Data assignment to a data.frame

Description

Assign a Opal table to a data.frame identified by a R symbol in the current R session.

Usage

opal.assign.table(
  opal,
  symbol,
  value,
  variables = NULL,
  missings = FALSE,
  identifiers = NULL,
  id.name = NULL,
  updated.name = NULL,
  class = "data.frame",
  async = FALSE
)

Arguments

opal

Opal object or list of opal objects.

symbol

Name of the R symbol.

value

The value to assign evaluated in the following order: a fully qualified name of a variable or a table in Opal.

variables

List of variable names or Javascript expression that selects the variables of a table (ignored if value does not refere to a table). See javascript documentation: http://wiki.obiba.org/display/OPALDOC/Variable+Methods

missings

If TRUE, missing values will be pushed from Opal to R, default is FALSE.

identifiers

Name of the identifiers mapping to use when assigning entities to R (from Opal 2.0).

id.name

Add a vector with the given name representing the entity identifiers (from Opal 2.6). Default is NULL.

updated.name

Deprecated. Add a vector with the given name representing the creation and last update timestamps (from Opal 2.6). Default is NULL.

class

The data frame class into which the table is written: can 'data.frame' (default) or 'tibble' (from Opal 2.6 to 2.13) or 'tibble.with.factors' (from Opal 2.14).

async

R script is executed asynchronously within the session (default is FALSE). If TRUE, the value returned is the ID of the command to look for (from Opal 2.1).

See Also

Other assignment functions: opal.assign.data(), opal.assign.resource(), opal.assign.script(), opal.assign.table.tibble(), opal.assign()

Examples

Run this code
if (FALSE) {
o <- opal.login('administrator','password', url='https://opal-demo.obiba.org')
# assign a list of variables from table CNSIM1
opal.assign.table(o, symbol="D", value="datashield.CNSIM1", variables=list("GENDER","LAB_TSC"))
opal.execute(o, "colnames(D)")
# assign a table CNSIM1 with a identifiers column
opal.assign.table(o, symbol="H", value="datashield.CNSIM1", id.name="id")
opal.execute(o, "colnames(H)")
# assign all the variables matching 'LAB' from table HOP of opal object o
opal.assign.table(o, symbol="D", value="datashield.CNSIM1", variables="name().matches('LAB_')")
opal.execute(o, "colnames(D)")
opal.logout(o)
}

Run the code above in your browser using DataLab