Table to R does not execute within Survival analysis workflow

Hi everyone,

I have an old KNIME workflow for survival analysis on a public and popular employee dataset that contains 1470 rows and 33 columns, and I’m running into an issue within a metanode for variable selection.

Inside a loop (Column List Loop Start), I iterate over columns and pass them to an R node (Table to R). My goal is to compute a log-rank test (survdiff from the survival package) for each variable against the survival outcome.

Here is the R script being used:

library("survival")

variable <- knime.flow.in[["currentColumnName"]]
column <- knime.in[,variable]

diff <- survdiff(Surv(knime.in$"Duración", knime.in$"Abandono") ~ column, data = knime.in, rho = 0)

significacion <- pchisq(diff$chisq, length(diff$n)-1, lower.tail = FALSE)

print(significacion)

However, the node does not execute properly.

Has anyone faced a similar issue or knows the correct way to handle it?

I would really appreciate any guidance or suggestions. I am sharing the workflow and dataset.

Thanks in advance!

Survival workflow.knar (258.1 KB)

DataSet.csv (364.4 KB)

@Gumersinda when I try to download the workflow and example I get the message that the page does not exist.

@mlauber71 thanks for the feedback about not being able to download that. I will figure that out and attach again asap

Survival Analysis.knwf (283.5 KB)

Can you download these ones?

DataSetAbandono.csv (364.4 KB)

@Gumersinda you can check out a first approach here how to collect data from an R Snippet with data similar to your case. Will see if I can check your uploaded example.

https://hub.knime.com/s/4ePzM-eDQmLKizwb

@Gumersinda the handling of paths and column names is a mess to be honest. You will have to check the column names and encodings of the file and see that the columns iterate in a correct way.

I started fixing it but got stuck at some point where there is a reference to a jpg on some folder. My recommendation would be to start fixing this and make the path dynamic or configurable:

Survival Analysis.knwf (3.0 MB)

Many thanks @mlauber71 !! I will have a look and try follow that :slightly_smiling_face:

1 Like