Before you can analyze and visualize data, you have to get that data into R. There are various ways to do this, depending on how your data is formatted and where it’s located.
Usually, the function you use to import data depends on the data’s file format. In base R, for example, you can import a CSV file with read.csv(). Hadley Wickham created a package called readxl that, as you might expect, has a function to read in Excel files. There’s another package, googlesheets, for pulling in data from Google spreadsheets.
[ Get Sharon Machlis’s R tips in our how-to video series. | Read the InfoWorld tutorials: Learn to crunch big data with R. • How to reshape data in R. • R data manipulation tricks at your fingertips • Beginner’s guide to R. | Stay up to date on analytics and big data with the InfoWorld Big Data Report newsletter. ]
But if you don’t want to remember all that, there’s rio.
The magic of rio
“The aim of rio is to make data file I/O [import/output] in R as easy as possible by implementing three simple functions in Swiss-army knife style,” according to the project’s GitHub page. Those functions are import(), export(), and convert().