Getting summary.lm output from R into Report

Hey there,

 

I'm trying for quite a while now to get the results of a linear regression done with R into a report. But the R snippet just accepts data.frames as an output and not the summary.lm.

 

is there another node that I have overseen so far which can solve this problem? Or a way to get the text from the "View R Std Output" into a report?

 

Best regards

Hi,

it turns out it is possible by using the R capture.output() function and then type-casting its output to a data frame.

For example, assuming your input table has a X and Y columns, you can use an R Snippet node with this code:

  knime.out <- as.data.frame(capture.output(summary.lm(lm(knime.in$"Y" ~ knime.in$"X"))))

It will generate as output a KNIME table with each row being a line of the output of the summary.lm function. Once you have this table you can send it to a report easily with the Data to Report node. In the report you can display it as a Table. See the screenshot below. It actually looks pretty neat!

Cheers,
Marco.

Hey Marco

Thank you very much for your answer! It was very helpful for me and works fine!

Best regards

DieBürgschaft

 

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.