Error converting text to lowercase with tm_map(..., tolower)

jackStinger picture jackStinger · Nov 30, 2012 · Viewed 65.7k times · Source

I tried using the tm_map. It gave the following error. How can I get around this?

 require(tm)
 byword<-tm_map(byword, tolower)

Error in UseMethod("tm_map", x) : 
  no applicable method for 'tm_map' applied to an object of class "character"

Answer

bdemarest picture bdemarest · Nov 30, 2012

Use the base R function tolower():

tolower(c("THE quick BROWN fox"))
# [1] "the quick brown fox"