Dateien herunterladen

Fortgeschrittenes Importieren von Daten in R

Filip Schouwenaars

Instructor, DataCamp

Beispiel: Excel

library(readxl)

read_excel("http://assets.datacamp.com/course/ importing_data_into_r/cities.xlsx")
Fehler:
'http://assets.datacamp.com/course/importing_data_into_r/cities.xlsx' 
ist im aktuellen Arbeitsverzeichnis nicht vorhanden.
Fortgeschrittenes Importieren von Daten in R

download.file()

url <- "http://assets.datacamp.com/
            course/importing_data_into_r/cities.xlsx"

dest_path <- file.path("~", "local_cities.xlsx")
download.file(url, dest_path)
// Meldungen zum Download-Fortschritt ausgelassen
read_excel(dest_path)
    Capital Population
1  New York   16044000
2    Berlin    3433695
3    Madrid    3010492
4 Stockholm    1683713
Fortgeschrittenes Importieren von Daten in R

Warum download.file()?

  • Reproduzierbarkeit

  • HTTP aus R heraus

    • Authentifizierung

    • Zusätzliche Parameter

    • httr – Hadley Wickham

Fortgeschrittenes Importieren von Daten in R

Lass uns üben!

Fortgeschrittenes Importieren von Daten in R

Preparing Video For Download...