inspect: Inspect Objects

Description Usage Arguments Examples

View source: R/corpus.R

Description

Inspect, i.e., display detailed information on a corpus, a term-document matrix, or a text document.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'PCorpus'
inspect(x)
## S3 method for class 'VCorpus'
inspect(x)
## S3 method for class 'TermDocumentMatrix'
inspect(x)
## S3 method for class 'TextDocument'
inspect(x)

Arguments

x

Either a corpus, a term-document matrix, or a text document.

Examples

1
2
3
4
5
data("crude")
inspect(crude[1:3])
inspect(crude[[1]])
tdm <- TermDocumentMatrix(crude)[1:10, 1:10]
inspect(tdm)

Example output

Loading required package: NLP
<<VCorpus>>
Metadata:  corpus specific: 0, document level (indexed): 0
Content:  documents: 3

$`reut-00001.xml`
<<PlainTextDocument>>
Metadata:  15
Content:  chars: 527

$`reut-00002.xml`
<<PlainTextDocument>>
Metadata:  15
Content:  chars: 2634

$`reut-00004.xml`
<<PlainTextDocument>>
Metadata:  15
Content:  chars: 330

<<PlainTextDocument>>
Metadata:  15
Content:  chars: 527

Diamond Shamrock Corp said that
effective today it had cut its contract prices for crude oil by
1.50 dlrs a barrel.
    The reduction brings its posted price for West Texas
Intermediate to 16.00 dlrs a barrel, the copany said.
    "The price reduction today was made in the light of falling
oil product prices and a weak crude oil market," a company
spokeswoman said.
    Diamond is the latest in a line of U.S. oil companies that
have cut its contract, or posted, prices over the last two days
citing weak oil markets.
 Reuter
<<TermDocumentMatrix (terms: 10, documents: 10)>>
Non-/sparse entries: 9/91
Sparsity           : 91%
Maximal term length: 10
Weighting          : term frequency (tf)
Sample             :
            Docs
Terms        127 144 191 194 211 236 237 242 246 248
  "(it)        0   0   0   0   0   0   1   0   0   0
  "demand      0   1   0   0   0   0   0   0   0   0
  "expansion   0   0   0   0   0   0   0   0   0   0
  "for         0   0   0   0   0   0   1   0   0   0
  "growth      0   0   0   0   0   0   1   0   0   0
  "if          0   0   0   0   0   1   0   0   0   0
  "is          0   0   0   0   0   0   0   0   0   1
  "may         0   0   0   0   0   0   0   0   0   1
  "none        0   0   0   0   0   1   0   0   0   0
  "opec        0   2   0   0   0   0   0   0   0   0

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