find pattern in summary

HI all,

I am trying to find a pattern "0.0%" in my summary to replace it with "-"
i am trying

tab[,2] <- paste0(tab[,2],"%")
tab[,2] <- gsub(regex("^0.?0+$",tab[,2]),"-",tab[,2],fixed=T)
tab

but getting error
Error: '.' is an unrecognized escape in character string starting ""^0."

any solution we have for this

library("stringr")
str_replace("0.0%", "^0\\.?0+%$", "-")

Hope it helps :slightly_smiling_face:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.