Tải tệp

Nhập dữ liệu nâng cao trong R

Filip Schouwenaars

Instructor, DataCamp

Ví dụ: Excel

library(readxl)

read_excel("http://assets.datacamp.com/course/ importing_data_into_r/cities.xlsx")
Lỗi:
'http://assets.datacamp.com/course/importing_data_into_r/cities.xlsx' 
không tồn tại trong thư mục làm việc hiện tại.
Nhập dữ liệu nâng cao trong 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)
// Đã lược bỏ thông báo tiến trình tải xuống
read_excel(dest_path)
    Capital Population
1  New York   16044000
2    Berlin    3433695
3    Madrid    3010492
4 Stockholm    1683713
Nhập dữ liệu nâng cao trong R

Vì sao dùng download.file()?

  • Tái lập kết quả

  • HTTP ngay trong R

    • Xác thực

    • Tham số bổ sung

    • httr - Hadley Wickham

Nhập dữ liệu nâng cao trong R

Ayo berlatih!

Nhập dữ liệu nâng cao trong R

Preparing Video For Download...