For a corpus object, returns the first or last n documents.

# S3 method for corpus
head(x, n = 6L, ...)

# S3 method for corpus
tail(x, n = 6L, ...)

Arguments

x

a dfm object

n

a single integer. If positive, the number of documents for the resulting object: number of first/last documents for the dfm. If negative, all but the n last/first number of documents of x.

...

additional arguments passed to other functions

Value

A corpus class object corresponding to the subset defined by n.

Examples

head(data_corpus_irishbudget2010, 3) %>% summary()
#> Corpus consisting of 3 documents: #> #> Text Types Tokens Sentences year debate number foren name #> Lenihan, Brian (FF) 1953 8641 374 2010 BUDGET 01 Brian Lenihan #> Bruton, Richard (FG) 1040 4446 217 2010 BUDGET 02 Richard Bruton #> Burton, Joan (LAB) 1624 6393 307 2010 BUDGET 03 Joan Burton #> party #> FF #> FG #> LAB #> #> Source: /Users/kbenoit/Dropbox (Personal)/GitHub/quanteda/* on x86_64 by kbenoit #> Created: Wed Jun 28 22:04:18 2017 #> Notes:
tail(data_corpus_irishbudget2010, 3) %>% summary()
#> Corpus consisting of 3 documents: #> #> Text Types Tokens Sentences year debate number foren #> Ryan, Eamon (Green) 510 1643 90 2010 BUDGET 12 Eamon #> Cuffe, Ciaran (Green) 442 1240 45 2010 BUDGET 13 Ciaran #> OCaolain, Caoimhghin (SF) 1188 4044 176 2010 BUDGET 14 Caoimhghin #> name party #> Ryan Green #> Cuffe Green #> OCaolain SF #> #> Source: /Users/kbenoit/Dropbox (Personal)/GitHub/quanteda/* on x86_64 by kbenoit #> Created: Wed Jun 28 22:04:18 2017 #> Notes: