I have a large tar.gz
file (>2GB) from which I want to read a specific .dat
file in R without unzipping the original tar.gz
file.
I tried to follow this post as follows:
p35_data_path <- "~/P35_fullset.tar.gz"
file.exists(p35_data_path) #TRUE
# Try to readin foldera/class1/mydata.dat from the zip file
mydata <- read.table(unz(p35_data_path
, "foldera/class1/mydata.dat"))
When I run the above I get a read.table
error as
Error in open.connection(file, "rt") : cannot open the connection
In addition: Warning message:
In open.connection(file, "rt") :
cannot open zip file '~/P35_fullset.tar.gz'
The "~/P35_fullset.tar.gz"
file exists. And the specific file within it definitely exists foldera/class1/mydata.dat
.
Could anyone please assist in rectifying this?