Dear all, I'm trying to gsub() "%" with "\%" with no obvious success. > temp1 <- c("mean", "sd", "0%", "25%", "50%", "75%", "100%") > temp1 [1] "mean" "sd" "0%" "25%" "50%" "75%" "100%" > gsub("%", "\%", temp1, fixed=TRUE) [1] "mean" "sd" "0%" "25%" "50%" "75%" "100%" Warning messages: 1: '\%' is an unrecognized escape in a character string 2: unrecognized escape removed from "\%"
I am not quite sure on how to deal with this error message. I tried the following > gsub("%", "\\%", temp1, fixed=TRUE) [1] "mean" "sd" "0\\%" "25\\%" "50\\%" "75\\%" "100\\%" Could anyone suggest how to obtain output similar to: [1] "mean" "sd" "0\%" "25\%" "50\%" "75\%" "100\%" Thank you, Liviu -- Do you know how to read? http://www.alienetworks.com/srtest.cfm Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.