如果在字符串中找到单词d
和SELF EMPLOYED
,我想用字符串SELF
替换一组字符串(EMPLOYED
)。
d <- c("SELF EMPLOYED-EMPLOYED", "SELF- EMPLOYED", "MYSELF
SELF-EMPLOYED AND BARNARD COLLEGE", "SELF EMPLOYED BUSINESS", "CENTER FOR SELF-ANALYSIS INCORPORATED")
这似乎不起作用:
d[grepl("SELF" & "EMPLOYED", d, ignore.case=FALSE)] <- "SELF EMPLOYED"
我收到以下错误:
Error in "SELF" & "EMPLOYED" :
operations are possible only for numeric, logical or complex types
请您详细说明我应该如何对此进行编码?