使用 tm_map(..., tolower) 将文本转换为小写时出错 [英] Error converting text to lowercase with tm_map(..., tolower)

查看:32
本文介绍了使用 tm_map(..., tolower) 将文本转换为小写时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 tm_map.它给出了以下错误.我该如何解决这个问题?

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"

推荐答案

使用基础 R 函数 tolower():

Use the base R function tolower():

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

这篇关于使用 tm_map(..., tolower) 将文本转换为小写时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆