Learn R Programming

quanteda (version 1.3.13)

head.corpus: Return the first or last part of a corpus

Description

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

Usage

# 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

Run this code
# NOT RUN {
head(data_corpus_irishbudget2010, 3) %>% summary()

tail(data_corpus_irishbudget2010, 3) %>% summary()
# }

Run the code above in your browser using DataLab