我现在正在学习R,我遇到了查找命令的问题.
我有分类数据
levels(job)
[1] "admin." "blue-collar" "entrepreneur" "housemaid"
[5] "management" "retired" "self-employed" "services"
[9] "student" "technician" "unemployed" "unknown"
Run Code Online (Sandbox Code Playgroud)
现在我想简化这些级别,例如
levels(job)
[1] "class1" "class2" "class3" "unknown"
Run Code Online (Sandbox Code Playgroud)
其中type1包括"admin.","entrepreneur",和"self-employed";
type2包括"blue-collar","management",和"technician";
type3包括"housemaid","student","retired",和"services";
unknown包括"unknown"和"unemployed".
为此,我可以使用哪个命令?谢谢!严
在以下字符串中:
"I may opt for a yam for Amy, May, and Tommy."
Run Code Online (Sandbox Code Playgroud)
如何删除非字母字符并将所有字母转换为小写并对R中每个单词中的字母进行排序?
同时,我尝试在句子中对单词进行排序并删除重复项.