ds.look {dsBaseClient}R Documentation

Performs direct call to a server-side aggregate function

Description

The function ds.look can be used to make a direct call to a server-side aggregate function more simply than using the datashield.aggregate function.

Usage

ds.look(toAggregate = NULL, checks = FALSE, datasources = NULL)

Arguments

toAggregate

a character string specifying the function call to be made. For more information see Details.

checks

logical. If TRUE the optional checks are undertaken. Default FALSE to save time.

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.

Details

The ds.look and datashield.aggregate functions are generally only recommended for experienced developers. For example, the toAggregate argument has to be expressed in the same form that the server-side function would usually expect from its client-side pair. For example: ds.look("table1DDS(female)") works. But, if you express this as ds.look("table1DDS('female')") it won't work because although when you call this same function using its client-side function you write ds.table1D('female') the inverted commas are stripped off during processing by the client-side function so the call to the server-side does not contain inverted commas.

Apart from during development work (e.g. before a client-side function has been written) it is almost always easier and less error-prone to call a server-side function using its client-side pair.

The function is a wrapper for the DSI package function datashield.aggregate.

Value

the output from the specified server-side aggregate function to the client-side.

Author(s)

DataSHIELD Development Team

Examples

## Not run: 

  ## Version 6, for version 5 see the Wiki
  
  # connecting to the Opal servers

  require('DSI')
  require('DSOpal')
  require('dsBaseClient')

  builder <- DSI::newDSLoginBuilder()
  builder$append(server = "study1", 
                 url = "http://192.168.56.100:8080/", 
                 user = "administrator", password = "datashield_test&", 
                 table = "SURVIVAL.EXPAND_NO_MISSING1", driver = "OpalDriver")
  builder$append(server = "study2", 
                 url = "http://192.168.56.100:8080/", 
                 user = "administrator", password = "datashield_test&", 
                 table = "SURVIVAL.EXPAND_NO_MISSING2", driver = "OpalDriver")
  builder$append(server = "study3",
                 url = "http://192.168.56.100:8080/", 
                 user = "administrator", password = "datashield_test&", 
                 table = "SURVIVAL.EXPAND_NO_MISSING3", driver = "OpalDriver")
  logindata <- builder$build()
  
  connections <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D")
  
  #Calculate the length of a variable using the server-side function
  
  ds.look(toAggregate = "lengthDS(D$age.60)", 
          checks = FALSE,
          datasources = connections) 
          
  #Calculate the column names of "D" object using the server-side function
          
  ds.look(toAggregate = "colnames(D)",
          checks = FALSE, 
          datasources = connections)        
  
  # clear the Datashield R sessions and logout
  datashield.logout(connections)

## End(Not run)

[Package dsBaseClient version 6.3.0 ]