Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
stascher
Partner - Creator II
Partner - Creator II

Retrieving multiple columns from result of single R-server call in load script

Hello, 

I'm having difficulty retrieving multiple columns of data from result of a single call to R-Server in my load script.

Below is the data I send to the R-Server and a working R-Server SSE call, but the call only returns one column; "surv", even though the result object contains multiple columns. I'd like to retrieve both "surv" and "time" columns (and ideally the "strata" as well) from the result object at the same time.

If I remove the [1]$surv spec from the call (which actually works in RTerm), the SSE returns an error. 

Is it possible to accomplish what I'm trying to do? 

 

 

 

DataTable:
load * inline [
row,itime,status,x
1,9,1,Maintained
2,13,1,Maintained
3,13,0,Maintained
4,18,1,Maintained
5,23,1,Maintained
6,28,0,Maintained
7,31,1,Maintained
8,34,1,Maintained
9,45,0,Maintained
10,48,1,Maintained
11,161,0,Maintained
12,5,1,Nonmaintained
13,5,1,Nonmaintained
14,8,1,Nonmaintained
15,8,1,Nonmaintained
16,12,1,Nonmaintained
17,16,0,Nonmaintained
18,23,1,Nonmaintained
19,27,1,Nonmaintained
20,30,1,Nonmaintained
21,33,1,Nonmaintained
22,43,1,Nonmaintained
23,45,1,Nonmaintained
];

RData1:
Load * Extension R.ScriptEval('library(survival);res<-survfit(Surv(q$itime,q$status)~1+strata(q$x),start.time=0);res[1]$surv;',DataTable{itime ,status,x});

 

 

 

For what it's worth, the above can be tested in RTerm using:
> library(survival)

> res <- survfit(Surv(time,status)~1+strata(x),data=aml)

Thanks for any help.

Labels (2)
0 Replies