Back
I'm writing an R package where the R code talks to a Java application. The Java application outputs a CSV formatted string and I want the R code to be able to directly read the string and convert it into a data.frame.
To read from a string using read.csv, you can use the text argument of read.csv.
For example:
data <- read.csv(text="col1,col20.2,4.27.71,34.84")
data <- read.csv(text="col1,col2
0.2,4.2
7.71,34.84")
Output:
data col1 col21 0.20 4.202 7.71 34.84
data
col1 col2
1 0.20 4.20
2 7.71 34.84
31k questions
32.8k answers
501 comments
693 users