Re: [R] How to use escape characters in a string

2010-01-29 Thread David Winsemius
On Jan 29, 2010, at 4:58 PM, mary guo wrote: Hi, I want to use a character as below in R, What character? as.character("`X^`R\`S") [1] "`X^`R`S" Warning messages: 1: '\`' is an unrecognized escape in a character string 2: unrecognized escape removed from "`X^`R\`S" > nchar("`X^`R\`S") [1]

Re: [R] How to use escape characters in a string

2010-01-29 Thread Bert Gunter
Please read R FAQ 7.37. You need to escape the backslash: > z<- as.character("`X^`R\\`S") > z [1] "`X^`R\\`S" > cat(z) `X^`R\`S Bert Gunter Genentech Nonclinical Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of mary guo