【发布时间】:2021-05-26 09:15:31
【问题描述】:
我想将字符串中的_ 替换为\_。
Test <-
c(".model", "sigma2", "log_lik", "AIC", "AICc", "BIC", "ar_roots",
"ma_roots")
library(stringr)
Test %>%
str_replace_all(string = ., pattern = "_", replacement = "\_")
Error: '\_' is an unrecognized escape in character string starting ""\_"
有什么提示吗?
【问题讨论】: