Get the features from a document-feature matrix, which are stored as the column names of the dfm object.

featnames(x)

Arguments

x

the dfm whose features will be extracted

Value

character vector of the feature labels

Examples

inaugDfm <- dfm(data_corpus_inaugural, verbose = FALSE) # first 50 features (in original text order) head(featnames(inaugDfm), 50)
#> [1] "fellow-citizens" "of" "the" "senate" #> [5] "and" "house" "representatives" ":" #> [9] "among" "vicissitudes" "incident" "to" #> [13] "life" "no" "event" "could" #> [17] "have" "filled" "me" "with" #> [21] "greater" "anxieties" "than" "that" #> [25] "which" "notification" "was" "transmitted" #> [29] "by" "your" "order" "," #> [33] "received" "on" "14th" "day" #> [37] "present" "month" "." "one" #> [41] "hand" "i" "summoned" "my" #> [45] "country" "whose" "voice" "can" #> [49] "never" "hear"
# first 50 features alphabetically head(sort(featnames(inaugDfm)), 50)
#> [1] "-" "," ";" ":" "!" #> [6] "?" "." "'" "\"" "(" #> [11] ")" "[" "]" "\\" ">" #> [16] "$" "1" "1,000" "100" "100,000,000" #> [21] "120,000,000" "125" "13" "14th" "15th" #> [26] "16" "1774" "1776" "1778" "1780" #> [31] "1787" "1789" "1790" "1800" "1801" #> [36] "1812" "1815" "1816" "1817" "1818" #> [41] "1826" "1850" "1861" "1868" "1873" #> [46] "1880" "1886" "1890" "1893" "1896"
# contrast with descending total frequency order from topfeatures() names(topfeatures(inaugDfm, 50))
#> [1] "the" "of" "," "and" "." #> [6] "to" "in" "a" "our" "that" #> [11] "we" "be" "is" "it" "for" #> [16] "by" "have" "which" "with" "not" #> [21] "as" "will" "i" "this" "all" #> [26] "are" "-" "their" "but" "has" #> [31] "people" "from" "its" ";" "government" #> [36] "or" "on" "my" "been" "us" #> [41] "can" "no" "they" "an" "so" #> [46] "upon" "who" "must" "at" "great"