2011-08-22 7 views
18
나는 R에서 다음 tar.gz 파일 다운로드 열고 싶은

:R에서 tar.gz 파일의 압축을 풉니 다.

http://s.wordpress.org/resources/survey/wp2011-survey.tar.gz

이 작업을 수행 할 수있는 명령이인가를?

감사합니다. 즉석, 나는 tar 파일에 도달하고 그것을 풀고하지 않고 적절한 csv 파일을 읽을 수있는 방법을 알고하지 않습니다

+0

봐'? untar' – James

+1

가능한 중복? http://stackoverflow.com/questions/3053833/using-r-to-download-zipped-data-file-extract-and-import-data – joran

+1

다른 중복? http://stackoverflow.com/questions/7044808/using-r-to-download-gzipped-data-file-extract-and-import-data/7045059#7045059 – Ramnath

답변

29
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") 

...에서

+0

tarball 내의 특정 파일 만 압축 해제 할 수 있습니까 ?? 나는'untar'에있는'files' 인자가 이것을하는 것 같지만 어떻게 확신 할 수 없습니까 ?? 도움을 주셨습니다. – Ashwin

+2

편집보기 ...... –

관련 문제