List the sheets of an Excel file
Before you can start importing from Excel, you should find out which sheets are available in the workbook. You can use the excel_sheets() function for this.
You will find the Excel file urbanpop.xlsx in your working directory (type dir() to see it). This dataset contains urban population metrics for practically all countries in the world throughout time (Source: Gapminder). It contains three sheets for three different time periods. In each sheet, the first row contains the column names.
Este ejercicio forma parte del curso
Importing Data in R (Part 1)
Instrucciones del ejercicio
- Load the
readxlpackage usinglibrary(). It's already installed on DataCamp's servers. - Use
excel_sheets()to print out the names of the sheets inurbanpop.xlsx.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Load the readxl package
# Print out the names of both spreadsheets