解压缩 tar.gz 文件? [英] unzip a tar.gz file?

查看:99
本文介绍了解压缩 tar.gz 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在 R 中下载并打开以下 tar.gz 文件:

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

顺便说一句,我不知道有什么方法可以访问 tar 文件并读取适当的 csv 文件而不解压缩它...

Offhand, I don't know of a way to reach into the tar file and read the appropriate csv file without unpacking it ...

这篇关于解压缩 tar.gz 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆