我想过滤掉列的字符串值中包含“*”的表的行。仅检查该列。
string_name = c("aaaaa", "bbbbb", "ccccc", "dddd*", "eee*eee")
zz <- sapply(tx$variant_full_name, function(x) {substrRight(x, -1) =="*"})
Error in FUN(c("Agno I30N", "VP2 E17Q", "VP2 I204*", "VP3 I85F", "VP1 K73R", :
could not find function "substrRight"
zz 的第四个值应该是 TRUE。
在python中有用于字符串的endswith函数[ string_s.endswith('*')] 有没有类似于R中的东西?
另外,是否因为 '*' 作为字符,因为它表示任何字符,所以有问题?grepl 也不起作用。
> grepl("*^",'dddd*')
[1] TRUE
> grepl("*^",'dddd')
[1] TRUE