1

这是我的数据:

> rep$strand
  [1] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  [58] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
  [115] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  [172] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  [229] + + + + + + + + + + + + + + + + + + + +

"+"为了将与分开"-",我尝试运行以下命令。

grepl("-",rep$strand) #this gives me a list of TRUE/FALSE that seems correct
grepl("+",rep$strand) #this is all TRUE for some mysterious reason

我不明白为什么相同的grepl()命令会起作用,"-"但不能起作用"+"

4

1 回答 1

6

利用

grepl("\\+", rep$strand)

或者

grepl("+", rep$strand, fixed = TRUE)

或者

"+" == rep$strand
于 2014-02-09T20:45:14.820 回答