combine: Combine Corpora, Documents, Term-Document Matrices, and Term...

Description Usage Arguments See Also Examples

Description

Combine several corpora into a single one, combine multiple documents into a corpus, combine multiple term-document matrices into a single one, or combine multiple term frequency vectors into a single term-document matrix.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'VCorpus'
c(..., recursive = FALSE)
## S3 method for class 'TextDocument'
c(..., recursive = FALSE)
## S3 method for class 'TermDocumentMatrix'
c(..., recursive = FALSE)
## S3 method for class 'term_frequency'
c(..., recursive = FALSE)

Arguments

...

Corpora, text documents, term-document matrices, or term frequency vectors.

recursive

Not used.

See Also

VCorpus, TextDocument, TermDocumentMatrix, and termFreq.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data("acq")
data("crude")
meta(acq, "comment", type = "corpus") <- "Acquisitions"
meta(crude, "comment", type = "corpus") <- "Crude oil"
meta(acq, "acqLabels") <- 1:50
meta(acq, "jointLabels") <- 1:50
meta(crude, "crudeLabels") <- letters[1:20]
meta(crude, "jointLabels") <- 1:20
c(acq, crude)
meta(c(acq, crude), type = "corpus")
meta(c(acq, crude))
c(acq[[30]], crude[[10]])
c(TermDocumentMatrix(acq), TermDocumentMatrix(crude))

Example output

Loading required package: NLP
<<VCorpus>>
Metadata:  corpus specific: 2, document level (indexed): 3
Content:  documents: 70
$comment
[1] "Acquisitions"

$comment
[1] "Crude oil"

attr(,"class")
[1] "CorpusMeta"
   acqLabels jointLabels crudeLabels
1          1           1        <NA>
2          2           2        <NA>
3          3           3        <NA>
4          4           4        <NA>
5          5           5        <NA>
6          6           6        <NA>
7          7           7        <NA>
8          8           8        <NA>
9          9           9        <NA>
10        10          10        <NA>
11        11          11        <NA>
12        12          12        <NA>
13        13          13        <NA>
14        14          14        <NA>
15        15          15        <NA>
16        16          16        <NA>
17        17          17        <NA>
18        18          18        <NA>
19        19          19        <NA>
20        20          20        <NA>
21        21          21        <NA>
22        22          22        <NA>
23        23          23        <NA>
24        24          24        <NA>
25        25          25        <NA>
26        26          26        <NA>
27        27          27        <NA>
28        28          28        <NA>
29        29          29        <NA>
30        30          30        <NA>
31        31          31        <NA>
32        32          32        <NA>
33        33          33        <NA>
34        34          34        <NA>
35        35          35        <NA>
36        36          36        <NA>
37        37          37        <NA>
38        38          38        <NA>
39        39          39        <NA>
40        40          40        <NA>
41        41          41        <NA>
42        42          42        <NA>
43        43          43        <NA>
44        44          44        <NA>
45        45          45        <NA>
46        46          46        <NA>
47        47          47        <NA>
48        48          48        <NA>
49        49          49        <NA>
50        50          50        <NA>
51        NA           1           a
52        NA           2           b
53        NA           3           c
54        NA           4           d
55        NA           5           e
56        NA           6           f
57        NA           7           g
58        NA           8           h
59        NA           9           i
60        NA          10           j
61        NA          11           k
62        NA          12           l
63        NA          13           m
64        NA          14           n
65        NA          15           o
66        NA          16           p
67        NA          17           q
68        NA          18           r
69        NA          19           s
70        NA          20           t
<<VCorpus>>
Metadata:  corpus specific: 0, document level (indexed): 0
Content:  documents: 2
<<TermDocumentMatrix (terms: 2959, documents: 70)>>
Non-/sparse entries: 6390/200740
Sparsity           : 97%
Maximal term length: 21
Weighting          : term frequency (tf)

tm documentation built on April 7, 2021, 3:01 a.m.