简体   繁体   中英

How to extract object data from Rdata file via command line?

Is there a way to do this? I want to write a bash script that can extract data from an object in an RData file and write it to a text file.

Without being too certain about the specifics of your request (please see about creating a minimal reproducible example ), does something like this work:

Assuming your.Rdata is called 'mtcars.Rdata' and contains a data.frame called mtcars and you want to write it to mtcars.csv .

You may have to change the path to where your Rscript.exe file lives.

"C:\Program Files\R\R-3.5.3\bin\Rscript" -e "load('mtcars.Rdata', env <- new.env());write.csv(env$mtcars, 'mtcars.csv')"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM