ds.wrapper: Wrapper function for DataSHIELD analysts

View source: R/ds.wrapper.R

ds.wrapperR Documentation

Wrapper function for DataSHIELD analysts

Description

The function summarises the outcome of variable-level aggregate DataSHIELD functions.

Usage

ds.wrapper(df = "D", ds_function = NULL, datasources = NULL, save = FALSE)

Arguments

df

A data.frame on the server-side. Default is "D".

ds_function

The aggregate DataSHIELD function you want to run to receive information (e.g. ds.class, ds.numNA).

datasources

A list of DSConnection-class objects obtained after login. If the datasources argument is not specified the default set of connections will be used: see datashield.connections_default.

save

If TRUE, the output is saved in the working directory as a csv file. Default is FALSE

Details

ds.wrapper wraps around DataSHIELD functions and creates summaries for all variables in a data.frame, providing an improved overview for the DataSHIELD analyst.

Value

A table with the output of the function. If more than one study is connected, they are joined in one table.

Author(s)

Sofia Siampani (Max-Delbrueck-Center, Berlin), Florian Schwarz (German Institute of Human Nutrition, Potsdam-Rehbruecke)

Examples

## Not run: 

# Version 1.0
# Connecting to Opal Servers

# loading necessary packages
require("DSI")
require("DSOpal")
require("dsBaseClient")
require("dsSupportClient")

builder <- DSI::newDSLoginBuilder()
builder$append(server = "study1",
               url = "http://192.168.56.100:8080/",
               user = "administrator", password = "datashield_test&",
               table = "CNSIM.CNSIM1", driver = "OpalDriver")
builder$append(server = "study2",
               url = "http://192.168.56.100:8080/",
               user = "administrator", password = "datashield_test&",
               table = "CNSIM.CNSIM2", driver = "OpalDriver")
builder$append(server = "study3",
               url = "http://192.168.56.100:8080/",
               user = "administrator", password = "datashield_test&",
               table = "CNSIM.CNSIM3", driver = "OpalDriver")

logindata <- builder$build()

# Log onto the remote Opal training servers
connections <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D")

# Retrieving information on variable classes in the specified data.frame
ds.wrapper(df = "D", ds_function = ds.class)


# Retrieving information on how many NAs are present in each variable in the specified data.frame
ds.wrapper(df = "D", ds_function = ds.numNA)


# Clear the Datashield R sessions and logout
datashield.logout(connections)


## End(Not run)

sofiasiamp/datashieldDescriptives documentation built on Oct. 31, 2024, 10:25 a.m.