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

Description Usage Arguments Details Examples

View source: R/casechange-functions.R

Description

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

Usage

1
2
3
4
5
6
7
dfm_tolower(x, keep_acronyms = FALSE, ...)

dfm_toupper(x, ...)

fcm_tolower(x, keep_acronyms = FALSE, ...)

fcm_toupper(x, ...)

Arguments

x

the input object whose character/tokens/feature elements will be case-converted

keep_acronyms

logical; if TRUE, do not lowercase any all-uppercase words (applies only to *_tolower functions)

...

additional arguments passed to stringi functions, (e.g. stri_trans_tolower), such as locale

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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)   

quanteda documentation built on Nov. 2, 2018, 1:05 a.m.