| loadtext | R Documentation |
(Down)Load a text file (and extract it if it is in a zip file).
loadtext(
file = NULL,
dir = tempdir(),
collapse = TRUE,
sep = NULL,
categories = NULL,
cache = FALSE
)
file |
The path or URL of the text file. If not specified, defaults to an interactive file chooser ( |
dir |
The directory the file is downloaded (and, for a zip archive, extracted) into.
Defaults to the session's temporary directory, which is emptied when R exits. Pass an
explicit path (together with |
collapse |
Indicates whether or not lines of each documents should collapse together or not. |
sep |
Separator between text fields. |
categories |
Columns that should be considered as categorical data. |
cache |
Whether the downloaded (and, for a zip archive, extracted) files are kept in
|
The text contained in the dowloaded file.
download.file, unzip
# Not run automatically: this downloads a 31 MB archive from a third-party server, so it
# depends on both the network and that server staying up.
## Not run:
text = loadtext ("http://mattmahoney.net/dc/text8.zip")
# Keep the archive between calls, in a directory of your choosing
text = loadtext ("http://mattmahoney.net/dc/text8.zip", dir = "~/corpora", cache = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.