Learn R Programming

quanteda (version 0.99.22)

head.dfm: return the first or last part of a dfm

Description

For a dfm object, returns the first or last n documents and first nfeature features.

Usage

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

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

Arguments

x

a dfm object

n

a single, positive integer. If positive, size 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.

nfeature

the number of features to return, where the resulting object will contain the first ncol features

...

additional arguments passed to other functions

Value

A dfm class object corresponding to the subset defined by n and nfeature.

Examples

Run this code
# NOT RUN {
head(data_dfm_lbgexample, 3, nfeature = 5)
head(data_dfm_lbgexample, -4)

tail(data_dfm_lbgexample)
tail(data_dfm_lbgexample, n = 3, nfeature = 4)
# }

Run the code above in your browser using DataLab