Learn R Programming

tm (version 0.6-1)

ZipSource: ZIP File Source

Description

Create a ZIP file source.

Usage

ZipSource(zipfile,
	  pattern = NULL,
	  recursive = FALSE,
	  ignore.case = FALSE,
          mode = "text")

Arguments

zipfile
A character string with the full path name of a ZIP file.
pattern
an optional regular expression. Only file names in the ZIP file which match the regular expression will be returned.
recursive
logical. Should the listing recurse into directories?
ignore.case
logical. Should pattern-matching be case-insensitive?
mode
a character string specifying if and how files should be read in. Available modes are: [object Object],[object Object],[object Object]

Value

Details

A ZIP file source extracts a compressed ZIP file via unzip and interprets each file as a document.

See Also

Source for basic information on the source infrastructure employed by package tm.

Examples

Run this code
zipfile <- tempfile()
files <- Sys.glob(file.path(system.file("texts", "txt", package = "tm"), "*"))
zip(zipfile, files)
zipfile <- paste0(zipfile, ".zip")
Corpus(ZipSource(zipfile, recursive = TRUE))[[1]]
file.remove(zipfile)

Run the code above in your browser using DataLab