ds.survfit: Creates a server-side Survival fit (survfit) object for use...

View source: R/ds.survfit.R

ds.survfitR Documentation

Creates a server-side Survival fit (survfit) object for use in Cox proportional hazards model.

Description

Creates a server side Survival fit (survfit) object,

Usage

ds.survfit(formula = NULL, objectname = NULL, datasources = NULL)

Arguments

formula

character string specifying the formula to be used in survival::survfit() on the server-side. For more information see Details.

objectname

character string of name of new server-side object which will store object of class survival::Surv()

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

This is a function that creates a server side survfit object. This is to be used in plotting results from survival analysis using the Cox proportional hazards model.

Server function called: survfitDS.

Value

SurvDS returns to the client-side a Surv() obejct for use in the Cox proportional hazards model

Author(s)

Soumya Banerjee and Tom Bishop, 2021

Examples

## Not run: 

  ## Version 2.0
  
  # 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") 
  
  # make sure that the outcome is numeric 
  ds.asNumeric(x.name = "D$cens",
            newobj = "EVENT",
            datasources = connections)

  ds.asNumeric(x.name = "D$survtime",
            newobj = "SURVTIME",
            datasources = connections)

  dsSurvivalClient::ds.Surv('SURVTIME', 'EVENT', 'surv_object')
  dsSurvivalClient::ds.coxph.SLMA(formula = 'surv_object~D$age+D$female')
  dsSurvivalClient::ds.survfit(formula='surv_object',object='survfit_object')   

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

## End(Not run)


neelsoumya/dsSurvivalClient documentation built on July 1, 2023, 10:32 p.m.