I would like to know how to download LEHD files from their FTP site.
https://lehd.ces.census.gov/data/lodes/LODES7/
I need to download the data for multiple years, for both workplace and resident place locations. The files are named regularly, and the technical documentation can be found here:
https://lehd.ces.census.gov/data/lodes/LODES7/LODESTechDoc7.2.pdf S000 references all workforce segments JT00 references all job types
So a typical file name is: ca_wac_S000_JT00_2008.csv.gz In the 'directory'/URL of: https://lehd.ces.census.gov/data/lodes/LODES7/ca/wac/
This bit of git-hub code seems relevant. The Harvard tutorial has been useful, and provided me with a way to create a list of all the files. But I can't get the actual download to work--R.curl hasn't worked for me, as I run into the SSL issue.
The extended code doesn't seem to work either:
install.packages("RCurl")
library(RCurl)
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
URL <- "https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2Fss06hid.csv"
x <- getURL(URL)
x
#the above code works.
#my implementation...fails
URL <- "https://lehd.ces.census.gov/data/lodes/LODES7/ca/wac/ca_wac_S000_JT00_2002.csv.gz"
x <- getURL(URL)
#results in following error:
#Error in function (type, msg, asError = TRUE) :
# error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
devtools::session_info() Session info --------------------------------------------------------------------------------------- setting value version R version 3.4.3 (2017-11-30) system x86_64, mingw32 ui RStudio (1.1.383) language (EN) collate English_United States.1252 tz America/Denver
date 2017-12-17Packages ------------------------------------------------------------------------------------------- package * version date source acs * 2.1.2
2017-10-10 CRAN (R 3.4.3) assertthat 0.2.0 2017-04-11 CRAN (R 3.4.3) base * 3.4.3 2017-12-06 local bindr 0.1 2016-11-13 CRAN (R 3.4.3) bindrcpp 0.2 2017-06-17 CRAN (R 3.4.3) class 7.3-14 2015-08-30 CRAN (R 3.4.3) classInt 0.1-24 2017-04-16 CRAN (R 3.4.3) compiler 3.4.3
2017-12-06 local curl * 3.1 2017-12-12 CRAN (R 3.4.3) datasets * 3.4.3 2017-12-06 local DBI 0.7 2017-06-18 CRAN (R 3.4.3) devtools * 1.13.4 2017-11-09 CRAN (R 3.4.3) digest 0.6.13 2017-12-14 CRAN (R 3.4.3) dplyr * 0.7.4 2017-09-28 CRAN (R 3.4.3) e1071 1.6-8 2017-02-02 CRAN (R 3.4.3) foreign 0.8-69 2017-06-22 CRAN (R 3.4.3) gdtools * 0.1.6 2017-09-01 CRAN (R 3.4.3) git2r 0.19.0
2017-07-19 CRAN (R 3.4.3) glue 1.2.0 2017-10-29 CRAN (R 3.4.3) graphics * 3.4.3 2017-12-06 local grDevices * 3.4.3 2017-12-06 local grid 3.4.3 2017-12-06 local hms 0.4.0 2017-11-23 CRAN (R 3.4.3) httr 1.3.1 2017-08-20 CRAN (R 3.4.3) lattice 0.20-35 2017-03-25 CRAN (R 3.4.3) lodes * 0.1.0 2017-12-17 git (@8cca008) magrittr 1.5 2014-11-22 CRAN (R 3.4.3) maptools 0.9-2
2017-03-25 CRAN (R 3.4.3) memoise 1.1.0 2017-04-21 CRAN (R 3.4.3) methods * 3.4.3 2017-12-06 local pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.3) plyr 1.8.4 2016-06-08 CRAN (R 3.4.3) purrr 0.2.4 2017-10-18 CRAN (R 3.4.3) R6
2.2.2 2017-06-17 CRAN (R 3.4.3) rappdirs 0.3.1 2016-03-28 CRAN (R 3.4.3) Rcpp 0.12.14 2017-11-23 CRAN (R 3.4.3) readr 1.1.1 2017-05-16 CRAN (R 3.4.3) rgdal 1.2-16 2017-11-21 CRAN (R 3.4.3) rgeos 0.3-26 2017-10-31 CRAN (R 3.4.3) rlang 0.1.4 2017-11-05 CRAN (R 3.4.3) sf 0.5-5 2017-10-31 CRAN (R 3.4.3) sp * 1.2-5 2017-06-29 CRAN (R 3.4.3) stats * 3.4.3 2017-12-06 local stringi 1.1.6 2017-11-17 CRAN (R 3.4.2) stringr * 1.2.0 2017-02-18 CRAN (R 3.4.3) tibble 1.3.4 2017-08-22 CRAN (R 3.4.3) tigris * 0.5.3
2017-05-26 CRAN (R 3.4.3) tools 3.4.3 2017-12-06 local
udunits2 0.13 2016-11-17 CRAN (R 3.4.1) units 0.4-6
2017-08-27 CRAN (R 3.4.3) utils * 3.4.3 2017-12-06 local
uuid 0.1-2 2015-07-28 CRAN (R 3.4.1) withr 2.1.0
2017-11-01 CRAN (R 3.4.3) XML * 3.98-1.9 2017-06-19 CRAN (R 3.4.1)