turning off escape sequences for a string

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

turning off escape sequences for a string

Stephen J. Barr-2
Hello,

I would like to create a matrix with one of the columns named
$\delta$. I have also created columns $\beta_1$ , $\beta_2$, etc.
However, it seems like \d is an escape sequence which gets
automatically removed. (Using these names such that they work right in
xtable -> latex)

colnames(simpleReg.mat) <- c("$\beta_1$","$SE(\beta_1)$", "$\beta_2$",
"$SE(\beta_2)$", "$\delta$", "$SE(\\delta)$")
Warning messages:
1: '\d' is an unrecognized escape in a character string
2: unrecognized escape removed from "$\delta$"

Is there a way to get R to not remove the unrecognized escape?

Thanks,
-stephen

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: turning off escape sequences for a string

cybaea
Backslashes in character strings need to be doubled.  Your "\b" is a
backspace.  "\\" is a backslash.

http://cran.r-project.org/doc/manuals/R-lang.html#Literal-constants



On 16/06/09 17:12, Stephen J. Barr wrote:

> Hello,
>
> I would like to create a matrix with one of the columns named
> $\delta$. I have also created columns $\beta_1$ , $\beta_2$, etc.
> However, it seems like \d is an escape sequence which gets
> automatically removed. (Using these names such that they work right in
> xtable ->  latex)
>
> colnames(simpleReg.mat)<- c("$\beta_1$","$SE(\beta_1)$", "$\beta_2$",
> "$SE(\beta_2)$", "$\delta$", "$SE(\\delta)$")
> Warning messages:
> 1: '\d' is an unrecognized escape in a character string
> 2: unrecognized escape removed from "$\delta$"
>
> Is there a way to get R to not remove the unrecognized escape?
>
> Thanks,
> -stephen
>
> ______________________________________________
> [hidden email] 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.
>    

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.