-
-
Save duxan/2cd638e0a026300977c6 to your computer and use it in GitHub Desktop.
# 1. set WD | |
setwd("C:/Users/Core-i5/Desktop/dataSci/3 Getting data/W3") # NOTE: change this PATH | |
# 2. make folder | |
if(!file.exists("./data")){ | |
dir.create("./data") | |
} | |
# 3. make handle | |
fileURL <- "https://github.com/DataScienceSpecialization/courses/blob/master/03_GettingData/dplyr/chicago.rds?raw=true" | |
# 4. download data | |
download.file(fileURL, destfile = "./data/chicago.rds", method = "curl", extra='-L') | |
# 5. read data | |
chicago <- readRDS("./data/chicago.rds") |
On my machine, this code works changing the download.file as follows:
download.file(fileURL, destfile = "./data/chicago.rds", extra='-L',mode='wb')
Setting the method to 'curl' didn't help, so I thought to play with the mode parameter based on the advice that it is mostly good to set it to 'wb'..
Thanks for this alternative/addition!
It seems that RDS is binary file and in my case it was recognized as such by default. But it is not something to rely on, as suggested here: http://stackoverflow.com/questions/29814405/why-do-i-need-to-use-mode-wb-with-download-file-for-this-rds-file
Thanks ,duxan
Yes,when using the
http://stackoverflow.com/questions/29814405/why-do-i-need-to-use-mode-wb-with-download-file-for-this-rds-file
it gives the right data ,and we can manipulate the Data with dplyr nicely and smoothly
coursera "Getting and Cleaning Data" week 3