reader and writer R

Hey guys :slight_smile:
Can you show me how to write table to R in knime in determine location and also change name file. And then how to open this in knime? :smiley:

Hi @pjacob
Not sure if I understand your question correctly. Are you looking for the nodes Table to R and R to Table?
You can find them in your node repository under Scripting > R, i.e. if you installed the “Knime R Scripting Extension”.
The Table to R node is intended to change a table from the internal Knime format into R, so you can use it in another R scripting node which takes R-date as input (e.g. the R to R node).
The R to Table node does the opposite action.
For these nodes there is not really a need to keep track of a filename or location. That’s all dealt with by Knime.

If this is not what you are looking for, please give a bit more explanation of the problem you are trying to solve.

@JanDuo Hi :smiley:
My friend give me table name “my_work” as a R table and how can I open this in Knime? I know there is a R Source (Table) but not exactly what I should write in this node ?

Hi @pjacob

Ah, you have a file containing an R table. Now I understand the need to specify a location and afilename. I assume this file is in the RData format (created with a save() function in R).

In that case you can indeed use the R Source (Table) node .

If you include code like this (via the configuration of the node) where my_work_dataframe is to be included in this my_work.RData file
afbeelding
So you can specify in the load() function the location and filename where you have it stored.

What you move to knime.out has to be an object of class data.frame, otherwise it’s not accepted by Knime. If it is something else (like a tibble), you have to change it to a dataframe first (or ask your friend to save his table as a dataframe in the RData file :wink: ).

6 Likes

You could have a look at these examples how to read and write data from and to R

https://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_r_export_data_rdata/k_001_r_export_data

3 Likes

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