View source: R/datashield.aggregate.R
datashield.aggregate | R Documentation |
Aggregates the expression result using the specified aggregation method in the current Datashield session.
datashield.aggregate(
conns,
expr,
async = TRUE,
success = NULL,
error = NULL,
errors.print = getOption("datashield.errors.print", FALSE)
)
conns |
|
expr |
Expression to evaluate. |
async |
Whether the result of the call should be retrieved asynchronously. When TRUE (default) the 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 aggregation result is received from a connection. The expected function signature is the connection/study name and the result value. Default is NULL (no callback). |
error |
Callback function that will be called each time the aggregation request has failed. The expected function signature is the connection/study name and the error message. Default is NULL (no callback). |
errors.print |
Boolean, whether to print datashield errors in the console or return a message indicating that they can be retrieved using 'datashield.errors'. |
The result of the aggregation
## Not run:
# call aggregate function on server side asynchronously
# i.e. each study connection will process the request in parallel
result <- datashield.aggregate(conns, expr = quote(someFunction(D, 123)))
# call aggregate function on server side synchronously, i.e. each study
# connection will be called, one after the other, in a blocking way
result <- datashield.aggregate(conns, expr = quote(someFunction(D, 123)), async = FALSE)
# call aggregate functions that are defined in the provided named list.
# Connections are filtered by the list names.
result <- datashield.aggregate(conns,
list(server1=quote(someFunction(D, 123)), server2=quote(someFunction(G, 456))))
# call aggregate function with callback functions
result <- datashield.aggregate(conns, expr = quote(someFunction(D, 123)),
success = function(server, res) {
# do something with server's result value
},
error = function(server, error) {
# do something with server's error message
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.