R transfers the data frame to another program using system ()

I have a data frame that I pass to another program using system(). In the current setup, I first write the contents of the data frame to a text file, and then execute the command system()for the created text file.

df1 <- runif(20)
write(df1, file="file1.txt")
system("myprogram file1.txt")

I have 2 questions:

1) Is there a way to transfer a data file directly without writing a text file?

2) If not, is there a way to transfer data in memory as a text object without writing the file to disk?

Thanks for any suggestions.

+5
source share
1 answer

You can write anything that R calls connections, and this includes network sockets.

, A , B , . help(connections), "".

- , R - . , , - , Google ( R RProtoBuf).

+7

All Articles