dssCoxph | R Documentation |
Executes coxph {survival} and survfit {survival} on the remote nodes
dssCoxph(..., async = TRUE, datasources = NULL)
... |
arguments to be sent to the 2 functions. Note, the data argument must be a character, the name of the input dataframe. If a newdata dataframe is present in the arguments, survfit will be called on the coxph object. The newdata dataframe argument must be sent as text describing the arguments to a call to data.frame() (see example). |
async |
same as in datashield.assign |
datasources |
same as in datashield.assign |
A list containing the stripped down coxph model (without the call and the residuals)
# open a local pseudo connection:
library(DSLite)
dslite.server1 <<- newDSLiteServer(config = defaultDSConfiguration(include=c('dsSwissKnife')))
builder <- newDSLoginBuilder()
builder$append(server="server1", url='dslite.server1',driver = "DSLiteDriver")
logindata <- builder$build()
opals <- datashield.login(logins = logindata)
# load the lung dataset
datashield.aggregate(opals[1], as.symbol('partialData("lung", NULL, NULL, "survival")'))
#create the new.dataframe argument (note the reference to the 'lung' data frame)
new.df <- 'sex = c(1, 2), age = rep(mean(lung$age, na.rm = TRUE), 2), ph.ecog = c(1, 1)'
# execute the function:
cox.res <- dssCoxph(formula = survival::Surv(time, status) ~ age + sex + ph.ecog, data = 'lung', new.dataframe = new.df, async = FALSE, datasources = opals[1])
summary(cox.res$server1$model)
# plot the fit:
plot(cox.res$local1$fit, conf.int = TRUE, col = c('blue', 'red'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.