readxl (1)

Einführung in das Importieren von Daten in R

Filip Schouwenaars

Instructor, DataCamp

Microsoft Excel

  • Häufiges Tool für Datenanalyse
  • Viele R-Packages für Excel
  • readxl – Hadley Wickham
Einführung in das Importieren von Daten in R

Typische Excel-Struktur

  • Mehrere Blätter mit Tabellendaten

Screenshot 2019-07-15 um 15.27.34.png

Einführung in das Importieren von Daten in R

readxl

  • excel_sheets()
    • listet Blätter auf
  • read_excel()
    • importiert Daten nach R
install.packages("readxl")
library(readxl)
Einführung in das Importieren von Daten in R

excel_sheets()

dir()
"cities.xlsx"  "the_rest_is_secret.txt"
excel_sheets("cities.xlsx")
"year_1990" "year_2000"
Einführung in das Importieren von Daten in R

read_excel()

read_excel("cities.xlsx")
# A tibble: 4 × 2
    Capital Population
      <chr>      <dbl>
1  New York   16044000
2    Berlin    3433695
3    Madrid    3010492
4 Stockholm    1683713
read_excel("cities.xlsx", sheet = 2)
read_excel("cities.xlsx", sheet = "year_2000")
# A tibble: 4 × 2
    Capital Population
      <chr>      <dbl>
1  New York   17800000
2    Berlin    3382169
3    Madrid    2938723
4 Stockholm    1942362
Einführung in das Importieren von Daten in R

Lass uns üben!

Einführung in das Importieren von Daten in R

Preparing Video For Download...