2011-08-22 22 views
18
Ben Ar aşağıdaki tar.gz dosyasını indirmek ve açmak isteyen

:R tar.gz dosyasını unzip?

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

gerçekleştirebilirsiniz bir komut var mı?

Teşekkürler. Düşüncesizce, ben tar dosyasına ulaşmak ve bunu ortaya koymadan, uygun csv dosyasını okumak için bir yol bilmiyorum

+0

Bak '? Untar' – James

+1

Olası yinelenen? http://stackoverflow.com/questions/3053833/using-r-to-download-zipped-data-file-extract-and-import-data – joran

+1

Başka bir kopya mı? http://stackoverflow.com/questions/7044808/using-r-to-download-gzipped-data-file-extract-and-import-data/7045059#7045059 – Ramnath

cevap

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

... en

+0

Ayrıca bir tarball içinde sadece belirli bir dosyayı açmak mümkün mü? Sanırım 'untar'daki' files' argüman bunu yapar ama emin değilim ne ?? Yardım .. – Ashwin

+2

bkz. Düzenleme ...... –

İlgili konular