Learn R Programming

quanteda.textmodels (version 0.9.9)

force_conformance: Internal function to match a dfm features to a target set

Description

Takes a dfm and a set of features, and makes them match the features listed in the set.

Usage

force_conformance(x, features, force = TRUE)

Value

a dfm from the quanteda package containing only features as columns, in the same order as features. A warning message is printed if some feature names from features are not matched in x.

Arguments

x

input dfm

features

character; a vector of feature names

force

logical; if TRUE, make the new dfm conform to the vector of features, otherwise return an error message

Examples

Run this code
quanteda.textmodels:::force_conformance(quanteda::data_dfm_lbgexample, c("C", "B", "Z"))

Run the code above in your browser using DataLab