lnt_convert: Convert LNToutput to other formats

Description Usage Arguments Details Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 what = "articles". If set to TRUE, an empty line will be added after each paragraphs. Alternatively you can enter a custom string (such as "\n" for newline). NULL or FALSE turns off this feature.

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:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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")

tCorpus <- lnt_convert(LNToutput, to = "corpustools")

tidy <- lnt_convert(LNToutput, to = "tidytext")

Corpus <- lnt_convert(LNToutput, to = "tm")

## Not run: 
dbloc <- lnt_convert(LNToutput, to = "SQLite") 

## End(Not run)

JBGruber/LexisNexisTools documentation built on Jan. 11, 2020, 12:14 p.m.