Skip to content

Instantly share code, notes, and snippets.

@duxan
Created June 20, 2015 12:21
Show Gist options
  • Select an option

  • Save duxan/2cd638e0a026300977c6 to your computer and use it in GitHub Desktop.

Select an option

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")
@duxan

duxan commented Jun 21, 2015

Copy link
Copy Markdown
Author

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

@derderi

derderi commented Jun 24, 2016

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment