It's Autumn! Prices fall like leaves! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Reading from a file
2. Reading a CSV file
Reading from an Excel file
Summary

Instruction

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

Exercise

Load the Echo Depths Mines' report (from the data/echo_depths_mines.csv file) and assign it to the echo_depths_mines variable. Use the read.csv() function.