Possible Duplicate:
unzip a tar.gz file?
I have a tar.gz file which contains a set of CSV files in it. How do I read only one file into R data frame?
Possible Duplicate:
unzip a tar.gz file?
I have a tar.gz file which contains a set of CSV files in it. How do I read only one file into R data frame?
If you know the filename of the file in the archive you want then you can specify that it be extracted and then read as per usual. E.g.
untar("foo.tar.gz", files = "foo2.csv")
will extract the file foo2.csv
from the archive foo.tar.gz
into the current working/local directory. You can then load that CSV in the usual way
read.csv("foo2.csv")
If you don't know the filenames, list them first:
> untar("foo.tar.gz", list = TRUE)
[1] "foo.csv" "foo2.csv"
then extract the one you want.