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 #> 2010_BUDGET_01_Brian_Lenihan_FF 1953 8641 374 2010 BUDGET 01 #> 2010_BUDGET_02_Richard_Bruton_FG 1040 4446 217 2010 BUDGET 02 #> 2010_BUDGET_03_Joan_Burton_LAB 1624 6393 307 2010 BUDGET 03 #> foren name party #> Brian Lenihan FF #> Richard Bruton FG #> Joan Burton 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 #> 2010_BUDGET_12_Eamon_Ryan_Green 510 1643 90 2010 BUDGET #> 2010_BUDGET_13_Ciaran_Cuffe_Green 442 1240 45 2010 BUDGET #> 2010_BUDGET_14_Caoimhghin_OCaolain_SF 1188 4044 176 2010 BUDGET #> number foren name party #> 12 Eamon Ryan Green #> 13 Ciaran Cuffe Green #> 14 Caoimhghin OCaolain SF #> #> Source: /Users/kbenoit/Dropbox (Personal)/GitHub/quanteda/* on x86_64 by kbenoit #> Created: Wed Jun 28 22:04:18 2017 #> Notes: