如何从字符串中删除这些字符 c() \ ][ ""

how to remove these characters from a string c () \ ][ ""

我有这样的字符串

st <- "c(c(c(\"E\" >= \"E\", \"B\" <= \"E\" | \"D\" <= \"B\"), \"A\" >= \"C\" | \"A\" >= \"A\"), c(\"E\" >= \"C\", \"D\" <= \"C\" | \"C\" <= \"C\")) []"

我想从中删除这些字符c () \ ][ ""

我想要这个

"E >= E, B <= E | D <= B, A >= C | A >= A, E >= C, D <= C | C <= C"

这里有一种方法可以解决您的问题:

gsub('[c()"]| \[\]', "", st)

# [1] "E >= E, B <= E | D <= B, A >= C | A >= A, E >= C, D <= C | C <= C"