Import Excel files from the web
When working with multiple data sources, .xls
is a common format for storage and exchange. You have been provided with a URL which you'll be using to download and import a .xls
file. The URL is already available in the sample code. Once downloaded, you will import the file using readxl
and inspect its content.
This is a part of the course
“Intermediate Importing Data in R”
Exercise instructions
- Load the
readxl
package. It is already installed on DataCamp's servers. - Use
download.file()
to download the.xls
file behind the URL and store it locally as"local_latitude.xls"
. - Import the
.xls
file located at the URLurl_xls
usingread_excel()
. Store the resulting data frame asexcel_readxl
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Load the readxl package
# Specification of url: url_xls
url_xls <- "https://assets.datacamp.com/production/course_1478/datasets/latitude.xls"
# Download file behind URL, name it local_latitude.xls
# Import the local .xls file
This exercise is part of the course
Intermediate Importing Data in R
Parse data in any format. Whether it's flat files, statistical software, databases, or data right from the web.
More and more of the information that data scientists are using resides on the web. Importing this data into R requires an understanding of the protocols used on the web. In this chapter, you'll get a crash course in HTTP and learn to perform your own HTTP requests from inside R.
Exercise 1: HTTPExercise 2: Import flat files from the webExercise 3: Secure importingExercise 4: Downloading filesExercise 5: Import Excel files from the webExercise 6: Downloading any file, secure or notExercise 7: Reading a text file from the webExercise 8: HTTP? httr! (1)Exercise 9: HTTP? httr! (2)What is DataCamp?
Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.