首页 > 解决方案 > R str_detect 但仅适用于以指定字符串开头的情况

问题描述

londonofficemarch<-londonofficemarch %>% 
  filter(str_detect(BNF_CODE, "0501"))

是我的代码。但是,这会在 BNF_CODE 列中找到任何位置都包含 0501 的值。我只想要以 0501 开头的术语。R中有能力做到这一点吗?

标签: rstringdplyr

解决方案


推荐阅读