Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Reading from a file
9. Loading data from the Internet
Reading from an Excel file


To complete our analysis, we need data about energy prices and gasoline prices in the USA, which will allow us to calculate costs. We can aquire the information from an official page, such as U.S. Government's open data, and manually load it into the memory, or we can simply download the data directly into memory of R. To do this, we use one of our reading functions with the URL as the argument (instead of the filename). Since the gas price data is in CSV format, we'll use the read.csv() function:


Note: You can also pass the URL as an argument to both read.delim() and read.table() functions.


Using the read.csv() function, download energy price data from the following site:

Assign this data to the energy_price_data variable.