Tabular data, or flat rectangular data, comes in many different formats, including CSV and TSV. R's readr package provides an easy and flexible way to import all kinds of data into R. It also fails gracefully if there are issues with the data you are trying to import. You can load the readr package with the following command:
library(readr)
The simplest way to import data with readr package is to call the specific read data function for different file types, depending on the data you are reading. For example, in the following screenshot, we have a CSV file containing data about automobiles. This data is also bundled as an example dataset with the readr package, as shown in the following screenshot:
Use the following command to read a particular CSV file in each column:
read_csv("mtcars.csv")#> Parsed...