Hands-On Exploratory Data Analysis with R
上QQ阅读APP看书,第一时间看更新

Manipulating data

Before you can start exploring your data, you first need to import it into your data analysis environment. There are many types of data, ranging from plain data in comma-separated value files to binary data in databases. Different R packages are equipped to handle these different kinds of data expertly and to import them almost ready for use in our environment. Since we are using R and RStudio, we will describe some of the most powerful R packages to import data in the following sections:

  • readr: readr can be used to read flat, rectangular data into R. It works with both comma-separated and tab-separated values.
  • readxl: We can use the readxl package to read data from MS Excel files.
  • jsonlite: Web services have increasingly started to provide data in a JSON format. The jsonlite package is a good way to import this kind of data into R.
  • httrrvest: httr, and rvest are very good packages to get data from the web, either from web APIs or by web scraping.
  • DBI: DBI is used to read data from relational databases into R.