Tutorial by Examples

Unzipping a zip archive is done with unzip function from the utils package (which is included in base R). unzip(zipfile = "bar.zip", exdir = "./foo") This will extract all files in "bar.zip" to the "foo" directory, which will be created if necessary. Tilde...
Listing files in a zip archive is done with unzip function from the utils package (which is included in base R). unzip(zipfile = "bar.zip", list = TRUE) This will list all files in "bar.zip" and extract none. Tilde expansion is done automatically from your working directory. ...
Listing files in a tar archive is done with untar function from the utils package (which is included in base R). untar(zipfile = "bar.tar", list = TRUE) This will list all files in "bar.tar" and extract none. Tilde expansion is done automatically from your working directory. ...
Extracting files from a tar archive is done with untar function from the utils package (which is included in base R). untar(tarfile = "bar.tar", exdir = "./foo") This will extract all files in "bar.tar" to the "foo" directory, which will be created if nece...
With a simple for loop, all zip archives in a directory can be extracted. for (i in dir(pattern=".zip$")) unzip(i) The dir function produces a character vector of the names of the files in a directory matching the regex pattern specified by pattern. This vector is looped through w...

Page 1 of 1