0

I'm currently implementing a tool in R and I got stucked with a problem. I looked already in the forums and didn't found anything.

I have many .csv files, which are somehow correlated with each other. The problem is I don't know yet how (this depends on the input of the user of the tool). Now I would like to read in a csv-file, that contains an arbitrary function f, e.g. f: a=b+max(c,d), and then the inputs, e.g. a="Final Sheet", b="Sheet1", c="Sheet2", d="Sheet3". (Maybe I didn't explained it very well, then I will upload a picture).

Now my question is, can I somehow read that csv file in, such that I can later use the function f in the programm? (Of course the given function has to be common in R).

I hope you understand my problem and I would appreciate any help or idea!!

mr_T
  • 1

1 Answers1

0

I would not combine data files with R source. Much easier to keep them separate. You put your functions in separate script files and then source() them as needed, and load your data with read.csv() etc.

"Keep It Simple" :-)

I am sure there's a contorted way of reading in the source code of a function from a text file and then eval() it somehow -- but I am not sure it would be worth the effort.

András Aszódi
  • 8,948
  • 5
  • 48
  • 51