[R] Special characters in cell names
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Wed Jun 23 21:08:27 CEST 2021
On 23/06/2021 11:38 a.m., Mahmood Naderan wrote:
> Hi
> I have a column in my data file which is "X/Y". With '/' I want to
> emphasize that values are the ratio of X over Y.
> Problem is that in the following command for a violin plot, I am not able
> to specify that '/' even with double quotes.
>
> p <- ggplot(mydata, aes(x=W, y="X/Y")) + geom_violin(trim=FALSE)
>
> However, if I change that column to "Y" and use
>
> p <- ggplot(mydata, aes(x=W, y=Y)) + geom_violin(trim=FALSE)
>
> Then the plot will be correctly shown.
> Any ideas for that?
I haven't tried, but I'd expect back quotes would work:
ggplot(mydata, aes(x=W, y=`X/Y`))
That's the normal way to quote a name in R.
Duncan Murdoch
More information about the R-help
mailing list