I wish to download and open the following tar.gz
file in R:
http://s.wordpress.org/resources/survey/wp2011-survey.tar.gz
Is there a command which can accomplish this?
fn <- "http://s.wordpress.org/resources/survey/wp2011-survey.tar.gz"
download.file(fn,destfile="tmp.tar.gz")
untar("tmp.tar.gz",list=TRUE) ## check contents
untar("tmp.tar.gz")
## or, if you just want to extract the target file:
untar("tmp.tar.gz",files="wp2011-survey/anon-data.csv")
X <- read.csv("wp2011-survey/anon-data.csv")
Offhand, I don't know of a way to reach into the tar file and read the appropriate csv file without unpacking it ...