LoslegenKostenlos loslegen

Renaming sheets

Come to think of it, "data_summary" is not an ideal name. As the summary of these excel sheets is always data-related, you simply want to name the sheet "summary".

The code to build a connection to "urbanpop.xlsx" and create my_book is already provided for you. It refers to an Excel file with 4 sheets: the three data sheets, and the "data_summary" sheet.

Diese Übung ist Teil des Kurses

Introduction to Importing Data in R

Kurs anzeigen

Anleitung zur Übung

  • Use renameSheet() to rename the fourth sheet to "summary".
  • Next, call getSheets() on my_book to print out the sheet names.
  • Finally, make sure to actually save the my_book object to a new Excel file, "renamed.xlsx".

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Build connection to urbanpop.xlsx: my_book
my_book <- loadWorkbook("urbanpop.xlsx")

# Rename "data_summary" sheet to "summary"
___

# Print out sheets of my_book
___

# Save workbook to "renamed.xlsx"
___
Code bearbeiten und ausführen