Stahování souborů

Intermediate Importing Data in R

Filip Schouwenaars

Instructor, DataCamp

Příklad: Excel

library(readxl)

read_excel("http://assets.datacamp.com/course/ importing_data_into_r/cities.xlsx")
Error:
'http://assets.datacamp.com/course/importing_data_into_r/cities.xlsx' 
does not exist in current working directory.
Intermediate Importing Data 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)
// Messages showing download progress omitted
read_excel(dest_path)
    Capital Population
1  New York   16044000
2    Berlin    3433695
3    Madrid    3010492
4 Stockholm    1683713
Intermediate Importing Data in R

Proč používat download.file()?

  • Reprodukovatelnost

  • HTTP z prostředí R

    • Ověřování totožnosti

    • Další parametry

    • httr - Hadley Wickham

Intermediate Importing Data in R

Pojďme procvičovat!

Intermediate Importing Data in R

Preparing Video For Download...