lnt_convert {LexisNexisTools} | R Documentation |
Convert LNToutput to other formats
Description
Takes output from lnt_read and converts it to other formats. You can
either use lnt_convert()
and choose the output format via to
or
use the individual functions directly.
Usage
lnt_convert(
x,
to = "data.frame",
what = "articles",
collapse = FALSE,
file = "LNT.sqlite",
...
)
lnt2df(x, what = "articles", ...)
lnt2rDNA(x, what = "articles", collapse = TRUE)
lnt2quanteda(x, what = "articles", collapse = NULL, ...)
lnt2tm(x, what = "articles", collapse = NULL, ...)
lnt2cptools(x, what = "articles", ...)
lnt2tidy(x, what = "articles", ...)
lnt2SQLite(x, file = "LNT.sqlite", ...)
Arguments
x |
An object of class LNToutput. |
to |
Which format to convert into. Possible values are "rDNA", "corpustools", "tidytext", "tm", "SQLite" and "quanteda". |
what |
Either "articles" or "paragraphs" to use articles or paragraphs as text in the output object. |
collapse |
Only has an effect when |
file |
The name of the database to be written to (for lnt2SQLite only). |
... |
Passed on to different methods (see details). |
Details
lnt_convert() provides conversion methods into several formats commonly used in prominent R packages for text analysis. Besides the options set here, the ... (ellipsis) is passed on to the individual methods for tuning the outcome:
data.frame, rDNA ... not used.
quanteda ... passed on to
quanteda::corpus()
.corpustools ... passed on to
corpustools::create_tcorpus()
.tm ... passed on to
tm::Corpus()
.tidytext ... passed on to
tidytext::unnest_tokens()
.lnt2SQLite ... passed on to
RSQLite::dbWriteTable-method()
.
Examples
LNToutput <- lnt_read(lnt_sample(copy = FALSE))
df <- lnt_convert(LNToutput, to = "data.frame")
docs <- lnt_convert(LNToutput, to = "rDNA")
corpus <- lnt_convert(LNToutput, to = "quanteda")
## Not run:
tCorpus <- lnt_convert(LNToutput, to = "corpustools")
tidy <- lnt_convert(LNToutput, to = "tidytext")
Corpus <- lnt_convert(LNToutput, to = "tm")
dbloc <- lnt_convert(LNToutput, to = "SQLite")
## End(Not run)