Let's suppose that we work for a mining company and part of our job is to prepare reports. The data comes in a variety of file formats.
The first format we'll work with is CSV. CSV files store tabular data as plain text. CSV stands for comma-separated values because each subsequent value in a CSV file is usually separated from the previous one by a comma. Here's an example of a CSV file:
first_name,last_name,monthly_production
Ellen,Blanque,282
Anica,Symons,230
Chaim,Robertelli,308
Let's review how to load a CSV file using the read.csv()
command. If we want to load the file data/Goldworth_Mines.csv
, we write:
read.csv("data/Goldworth_Mines.csv")
Eventually, we'll get the following data frame:
|
first_name |
last_name |
monthly_production |
1 |
Ellen |
Blanque |
282 |
2 |
Anica |
Symons |
230 |
3 |
Chaim |
Robertelli |
308 |