Assign a table or an expression result to a R symbol in the Datashield R session.
Note that usage of usage of respectively datashield.assign.table or
datashield.assign.expr should be preferred for readability.
Usage
datashield.assign(
conns,
symbol,
value,
variables = NULL,
missings = FALSE,
identifiers = NULL,
id.name = NULL,
async = TRUE,
success = NULL,
error = NULL
)Arguments
- conns
DSConnection-classobject or a list ofDSConnection-classs.- symbol
Name of the R symbol.
- value
Fully qualified name of a table reference in data repositories (see
datashield.assign.tablefor more details) OR a R expression with allowed assign functions calls (seedatashield.assign.exprfor more details).- 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://opaldoc.obiba.org/en/latest/magma-user-guide/variable/
- missings
If TRUE, missing values will be pushed from data repository to R, default is FALSE. Ignored if value is an R expression.
- identifiers
Name of the identifiers mapping to use when assigning entities to R (if supported by data repository).
- id.name
Name of the column that will contain the entity identifiers. If not specified, the identifiers will be the data frame row names. When specified this column can be used to perform joins between data frames.
- async
Whether the result of the call should be retrieved asynchronously (TRUE means that calls are parallelized over the connections, when the connection supports that feature, with an extra overhead of requests).
- success
Callback function that will be called each time an assignment is successful. The expected function signature is the connection/study name. Default is NULL (no callback).
- error
Callback function that will be called each time the assignment request has failed. The expected function signature is the connection/study name and the error message. Default is NULL (no callback).
Examples
if (FALSE) { # \dontrun{
# assign a list of variables from table CNSIM1
datashield.assign(conn, symbol="D", value="CNSIM.CNSIM1",
variables=list("GENDER","LAB_GLUC"))
# assign all the variables matching 'LAB' from table CNSIM1
datashield.assign(conn, symbol="D", value="CNSIM.CNSIM1",
variables="name().matches('LAB_')")
# do assignment with callback functions
datashield.assign(conns, "D",
list(server1="CNSIM.CNSIM1", server2="CNSIM.CNSIM2"),
success = function(server) {
# do something with server's success
},
error = function(server, error) {
# do something with server's error message
})
} # }