Use R to view and manipulate the File System

[This article was first published on Data Twirling, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

One of the best ways to learn how to code in R is to view sample scripts that people share.

I recently came across this post where Michael uses R to scrape twitter and collect all sorts of great data on the current unrest in the Middle East and northern Africa.  While the post is worthy of a read itself, what I found useful was the function ?file.exists.  The usage is obvious, but the help file exposed a collection of functions that I was not previously aware of.

For instance, I have used ?unlink before, but I had no idea that you could use R to create directories, walk file paths, etc.  I can’t speak for SAS, but I am quite certain you can’t do this natively in SPSS.

I have to admit that I probably should have already known about this, but the ability to programmatically manipulate files and directories are the sorts of things that keep affirming that time learning R is well spent.



To leave a comment for the author, please follow the link and comment on their blog: Data Twirling.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)