read.zip: Read Zip

Description Usage Arguments Details Value See Also

View source: R/helperFile.R

Description

Read in all files contained in a zip file

Usage

1
2
read.zip(zipfile, pattern = "\\.csv$", SIMPLIFY = TRUE, use.fwf = FALSE,
  ...)

Arguments

zipfile

name and path of a zip file containing files to read in

pattern

regular expression indicating the file extensions to be read. Default is .csv files

SIMPLIFY

logical, compress the contents into 2 data.table on output? To be safe, set FALSE

use.fwf

logical, indicating whether or not to read in as fixed width file; is overridden if file extensions are .fwf

...

other arguments to be passed on; in particular, the cols argument of column width if a fixed width file

Details

The function works by unzipping a file into a temporary directory, reading in all the files in that temporarily unzipped folder, and then deleting the temporary folder and all of its contents. Thus, is a handy way of keep all of your files stored as compressed files, but being able to access them. Obviously comes at the performance cost of having to do all of the unzipping and deleting. No longer uses data.table's fread because of a long-standing issue with quoted elements (comment fields in raw data files often have strange characters); now using read.csv. For .fwf formats fread.fwf is used.

Value

a data.table, or list of data.tables. The name of each element of the list is the name of the file within the .zip file.

See Also

fread.fwf read.trawl


rBatt/trawlData documentation built on May 26, 2019, 7:45 p.m.