a <- system.file(package = "archive", "extdata", "data.zip")
# Show files in archive
a
# By default reads the first file in the archive.
read.csv(archive_read(a), nrows = 3)
# Can also specify a filename directly
read.csv(archive_read(a, "mtcars.csv"), nrows = 3)
# Or by position
read.csv(archive_read(a, 3), nrows = 3)
# Explicitly specify the format and filter if automatic detection fails.
read.csv(archive_read(a, format = "zip"), nrows = 3)
Run the code above in your browser using DataLab