Learn R Programming

quanteda (version 0.9.9-50)

dfm_tolower: convert the case of the features of a dfm and combine

Description

dfm_tolower and dfm_toupper convert the features of the dfm to lower and upper case, respectively, and then recombine the counts.

Usage

dfm_tolower(x)

dfm_toupper(x)

fcm_tolower(x)

fcm_toupper(x)

Arguments

x
the dfm or fcm object

Details

fcm_tolower and fcm_toupper convert both dimensions of the fcm to lower and upper case, respectively, and then recombine the counts. This works only on fcm objects created with context = "document".

Examples

Run this code
# for a document-feature matrix
mydfm <- dfm(c("b A A", "C C a b B"), 
             toLower = FALSE, verbose = FALSE)
mydfm
dfm_tolower(mydfm) 
dfm_toupper(mydfm)
   
# for a feature co-occurrence matrix
myfcm <- fcm(tokens(c("b A A d", "C C a b B e")), 
             context = "document")
myfcm
fcm_tolower(myfcm) 
fcm_toupper(myfcm)   

Run the code above in your browser using DataLab