我的case_when陈述式出现意外错误

时间:2019-02-20 11:20:59

标签: r conditional case

编写case_when语句以使用条件语句分配的值来创建新列。但是,我不断收到错误消息:“错误消息中出现意外的”)“。

我的右方括号没什么问题

brfss2013 <- brfss2013 %>%
  mutate(mentalHealth = cut(menthlth,breaks=breaks4,labels=labels4,include.lowest=TRUE)) %>%
  mutate(incomeLev = case_when(grepl("*$15,000|*$20,000",income2)~"0-$20,000"
                               grepl("*$25,000|*$35,000",income2)~"$25,000-$35,000"
                               grepl("*$50,000|*than $75,000",income2)~"$50,000-$75,000"
                               income2 == "$75,000" ~ "Over $75,000"
                               )) 

0 个答案:

没有答案
相关问题