I know to run a shell script in R is using system command:
my.table <- system(command,intern=TRUE)
However, if the result of my "command" is to print out a table, and I want R to read the table directly into its own data structure. (something like data frame) Is there an easy way to do that? Because the current output in "table" is a character string table. What I want is the R object as read.table().
If the result 'table' has white-space separators and carriage-returns to mark lines, then you should pass the results to the 'text' argument of read.table:
inp.tbl <- read.table(text = system(command,intern=TRUE) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With