Re: [R] Special characters in cell names

2021-06-23 Thread David Winsemius
On my keyboard the key is share with the tilde symbol and is up on the left 
hand corner. 

Sent from my iPhone

> On Jun 23, 2021, at 2:45 PM, David Winsemius  wrote:
> 
> Backticks. NOT apostrophes. 
> 
> — David
> 
> Sent from my iPhone
> 
>> On Jun 23, 2021, at 2:40 PM, Mahmood Naderan  wrote:
>> 
>> Hi Bert,
>> I don't know what does "check.names" do here, but my commands look like
>> 
>> 
>>> mydata <- read.csv('r.3080..csv', header=T,row.names=1)
>> 
>>> head(mydata)
>> W  AX/Y
>> P1   M  1.469734 0.004144405
>> P2M 20.584841 0.008010306
>> P3 M 53.519800 0.166034888
>> P4  M 42.308700 0.051545443
>> P5   M 99.236384 0.893037857
>> P6M 94.279504 0.856837525
>> 
>> So when I use
>> 
>> p <- ggplot(mydata, aes(x=W, y='X/Y')) + geom_violin(trim=FALSE)
>> 
>> 
>> The output is not correct. I don't see values (scale) on the y-axis.
>> Anyway, I fixed that with a label.
>> 
>> Regards,
>> Mahmood
>> 
>> 
>> 
>> 
 On Wed, Jun 23, 2021 at 11:16 PM Bert Gunter  
 wrote:
>>> 
>>> I found your specification quite vague. What did you mean by a "data file"
>>> -- a data frame in R? -- a file in the file system?
>>> 
>>> I may be completely wrong here, but another possibility is that you read
>>> your data into an R data.frame via, e.g. read.table() or read.csv(), but
>>> failed to specify the check.names = FALSE, argument. This would cause a
>>> column named "x/y" in your original table to be given the name "x.y" in R,
>>> as "x/y" is not a syntactically valid name. See ?make.names for details.
>>> 
>>> As others have already said, enclosing non-syntactically valid names in
>>> back ticks usually works (maybe always works??). So for example:
>>> 
>>> z<-data.frame (`a/b` = 1:5, y = 1:5, check.names = FALSE)
>>> plot(y ~ `a/b`, data = z) ## produces desired plot with correct label
>>> z  ## yields:
>>> a/b y
>>> 1   1 1
>>> 2   2 2
>>> 3   3 3
>>> 4   4 4
>>> 5   5 5
>>> 
>>> Of course, ignore if this is all irrelevant.
>>> 
>>> Bert Gunter
>>> 
>>> "The trouble with having an open mind is that people keep coming along and
>>> sticking things into it."
>>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>>> 
>>> 
>>> On Wed, Jun 23, 2021 at 1:37 PM Mahmood Naderan 
>>> wrote:
>>> 
 Unfortunately, using 'X/Y' doesn't work either.
 Instead I used labels like below
 
 P + scale_y_continuous(name="X/Y")
 
 Thanks for the suggestions.
 
 Regards,
 Mahmood
 
 
 
 
 On Wed, Jun 23, 2021 at 9:22 PM Eric Berger 
 wrote:
 
> If no one comes up with a better suggestion:
> a. Change the column name to "Y" so that you get the plot you want
> b. Use axis labels and legend text to show the text that you want. (The
> user never has to know that you changed the column name )
> 
> HTH,
> Eric
> 
> On Wed, Jun 23, 2021 at 9:58 PM 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?
>> 
>> Regards,
>> Mahmood
>> 
>>   [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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]]
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the 

Re: [R] Special characters in cell names

2021-06-23 Thread Mahmood Naderan
OK I understand. Thanks a lot.


Regards,
Mahmood




On Wed, Jun 23, 2021 at 11:46 PM Bert Gunter  wrote:

> Try:
> ggplot(mydata, aes(x=W, y=`X/Y`)) + geom_violin(trim=FALSE)
>
> Note the use of *backticks*, ``, not single quotes, ' '  . ** They are
> different.**
>
> So, yes, your data got read in correctly, presumably because "/" is
> considered a character in your locale. It is not in mine. So my suggestion
> was indeed irrelevant.
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Wed, Jun 23, 2021 at 2:39 PM Mahmood Naderan 
> wrote:
>
>> Hi Bert,
>> I don't know what does "check.names" do here, but my commands look like
>>
>>
>> > mydata <- read.csv('r.3080..csv', header=T,row.names=1)
>>
>> > head(mydata)
>>   W  AX/Y
>> P1   M  1.469734 0.004144405
>> P2M 20.584841 0.008010306
>> P3 M 53.519800 0.166034888
>> P4  M 42.308700 0.051545443
>> P5   M 99.236384 0.893037857
>> P6M 94.279504 0.856837525
>>
>> So when I use
>>
>> p <- ggplot(mydata, aes(x=W, y='X/Y')) + geom_violin(trim=FALSE)
>>
>>
>> The output is not correct. I don't see values (scale) on the y-axis.
>> Anyway, I fixed that with a label.
>>
>> Regards,
>> Mahmood
>>
>>
>>
>>
>> On Wed, Jun 23, 2021 at 11:16 PM Bert Gunter 
>> wrote:
>>
>>> I found your specification quite vague. What did you mean by a "data
>>> file" -- a data frame in R? -- a file in the file system?
>>>
>>> I may be completely wrong here, but another possibility is that you read
>>> your data into an R data.frame via, e.g. read.table() or read.csv(), but
>>> failed to specify the check.names = FALSE, argument. This would cause a
>>> column named "x/y" in your original table to be given the name "x.y" in R,
>>> as "x/y" is not a syntactically valid name. See ?make.names for details.
>>>
>>> As others have already said, enclosing non-syntactically valid names in
>>> back ticks usually works (maybe always works??). So for example:
>>>
>>> z<-data.frame (`a/b` = 1:5, y = 1:5, check.names = FALSE)
>>> plot(y ~ `a/b`, data = z) ## produces desired plot with correct label
>>> z  ## yields:
>>>   a/b y
>>> 1   1 1
>>> 2   2 2
>>> 3   3 3
>>> 4   4 4
>>> 5   5 5
>>>
>>> Of course, ignore if this is all irrelevant.
>>>
>>> Bert Gunter
>>>
>>> "The trouble with having an open mind is that people keep coming along
>>> and sticking things into it."
>>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>>>
>>>
>>> On Wed, Jun 23, 2021 at 1:37 PM Mahmood Naderan 
>>> wrote:
>>>
 Unfortunately, using 'X/Y' doesn't work either.
 Instead I used labels like below

 P + scale_y_continuous(name="X/Y")

 Thanks for the suggestions.

 Regards,
 Mahmood




 On Wed, Jun 23, 2021 at 9:22 PM Eric Berger 
 wrote:

 > If no one comes up with a better suggestion:
 > a. Change the column name to "Y" so that you get the plot you want
 > b. Use axis labels and legend text to show the text that you want.
 (The
 > user never has to know that you changed the column name )
 >
 > HTH,
 > Eric
 >
 > On Wed, Jun 23, 2021 at 9:58 PM 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?
 >>
 >> Regards,
 >> Mahmood
 >>
 >> [[alternative HTML version deleted]]
 >>
 >> __
 >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 >> 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]]

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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]]

__
R-help@r-project.org mailing list -- To 

Re: [R] Special characters in cell names

2021-06-23 Thread Bert Gunter
Try:
ggplot(mydata, aes(x=W, y=`X/Y`)) + geom_violin(trim=FALSE)

Note the use of *backticks*, ``, not single quotes, ' '  . ** They are
different.**

So, yes, your data got read in correctly, presumably because "/" is
considered a character in your locale. It is not in mine. So my suggestion
was indeed irrelevant.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Jun 23, 2021 at 2:39 PM Mahmood Naderan 
wrote:

> Hi Bert,
> I don't know what does "check.names" do here, but my commands look like
>
>
> > mydata <- read.csv('r.3080..csv', header=T,row.names=1)
>
> > head(mydata)
>   W  AX/Y
> P1   M  1.469734 0.004144405
> P2M 20.584841 0.008010306
> P3 M 53.519800 0.166034888
> P4  M 42.308700 0.051545443
> P5   M 99.236384 0.893037857
> P6M 94.279504 0.856837525
>
> So when I use
>
> p <- ggplot(mydata, aes(x=W, y='X/Y')) + geom_violin(trim=FALSE)
>
>
> The output is not correct. I don't see values (scale) on the y-axis.
> Anyway, I fixed that with a label.
>
> Regards,
> Mahmood
>
>
>
>
> On Wed, Jun 23, 2021 at 11:16 PM Bert Gunter 
> wrote:
>
>> I found your specification quite vague. What did you mean by a "data
>> file" -- a data frame in R? -- a file in the file system?
>>
>> I may be completely wrong here, but another possibility is that you read
>> your data into an R data.frame via, e.g. read.table() or read.csv(), but
>> failed to specify the check.names = FALSE, argument. This would cause a
>> column named "x/y" in your original table to be given the name "x.y" in R,
>> as "x/y" is not a syntactically valid name. See ?make.names for details.
>>
>> As others have already said, enclosing non-syntactically valid names in
>> back ticks usually works (maybe always works??). So for example:
>>
>> z<-data.frame (`a/b` = 1:5, y = 1:5, check.names = FALSE)
>> plot(y ~ `a/b`, data = z) ## produces desired plot with correct label
>> z  ## yields:
>>   a/b y
>> 1   1 1
>> 2   2 2
>> 3   3 3
>> 4   4 4
>> 5   5 5
>>
>> Of course, ignore if this is all irrelevant.
>>
>> Bert Gunter
>>
>> "The trouble with having an open mind is that people keep coming along
>> and sticking things into it."
>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>>
>>
>> On Wed, Jun 23, 2021 at 1:37 PM Mahmood Naderan 
>> wrote:
>>
>>> Unfortunately, using 'X/Y' doesn't work either.
>>> Instead I used labels like below
>>>
>>> P + scale_y_continuous(name="X/Y")
>>>
>>> Thanks for the suggestions.
>>>
>>> Regards,
>>> Mahmood
>>>
>>>
>>>
>>>
>>> On Wed, Jun 23, 2021 at 9:22 PM Eric Berger 
>>> wrote:
>>>
>>> > If no one comes up with a better suggestion:
>>> > a. Change the column name to "Y" so that you get the plot you want
>>> > b. Use axis labels and legend text to show the text that you want. (The
>>> > user never has to know that you changed the column name )
>>> >
>>> > HTH,
>>> > Eric
>>> >
>>> > On Wed, Jun 23, 2021 at 9:58 PM 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?
>>> >>
>>> >> Regards,
>>> >> Mahmood
>>> >>
>>> >> [[alternative HTML version deleted]]
>>> >>
>>> >> __
>>> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> >> 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]]
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Special characters in cell names

2021-06-23 Thread David Winsemius
Backticks. NOT apostrophes. 

— David

Sent from my iPhone

> On Jun 23, 2021, at 2:40 PM, Mahmood Naderan  wrote:
> 
> Hi Bert,
> I don't know what does "check.names" do here, but my commands look like
> 
> 
>> mydata <- read.csv('r.3080..csv', header=T,row.names=1)
> 
>> head(mydata)
>  W  AX/Y
> P1   M  1.469734 0.004144405
> P2M 20.584841 0.008010306
> P3 M 53.519800 0.166034888
> P4  M 42.308700 0.051545443
> P5   M 99.236384 0.893037857
> P6M 94.279504 0.856837525
> 
> So when I use
> 
> p <- ggplot(mydata, aes(x=W, y='X/Y')) + geom_violin(trim=FALSE)
> 
> 
> The output is not correct. I don't see values (scale) on the y-axis.
> Anyway, I fixed that with a label.
> 
> Regards,
> Mahmood
> 
> 
> 
> 
>> On Wed, Jun 23, 2021 at 11:16 PM Bert Gunter  wrote:
>> 
>> I found your specification quite vague. What did you mean by a "data file"
>> -- a data frame in R? -- a file in the file system?
>> 
>> I may be completely wrong here, but another possibility is that you read
>> your data into an R data.frame via, e.g. read.table() or read.csv(), but
>> failed to specify the check.names = FALSE, argument. This would cause a
>> column named "x/y" in your original table to be given the name "x.y" in R,
>> as "x/y" is not a syntactically valid name. See ?make.names for details.
>> 
>> As others have already said, enclosing non-syntactically valid names in
>> back ticks usually works (maybe always works??). So for example:
>> 
>> z<-data.frame (`a/b` = 1:5, y = 1:5, check.names = FALSE)
>> plot(y ~ `a/b`, data = z) ## produces desired plot with correct label
>> z  ## yields:
>>  a/b y
>> 1   1 1
>> 2   2 2
>> 3   3 3
>> 4   4 4
>> 5   5 5
>> 
>> Of course, ignore if this is all irrelevant.
>> 
>> Bert Gunter
>> 
>> "The trouble with having an open mind is that people keep coming along and
>> sticking things into it."
>> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>> 
>> 
>> On Wed, Jun 23, 2021 at 1:37 PM Mahmood Naderan 
>> wrote:
>> 
>>> Unfortunately, using 'X/Y' doesn't work either.
>>> Instead I used labels like below
>>> 
>>> P + scale_y_continuous(name="X/Y")
>>> 
>>> Thanks for the suggestions.
>>> 
>>> Regards,
>>> Mahmood
>>> 
>>> 
>>> 
>>> 
>>> On Wed, Jun 23, 2021 at 9:22 PM Eric Berger 
>>> wrote:
>>> 
 If no one comes up with a better suggestion:
 a. Change the column name to "Y" so that you get the plot you want
 b. Use axis labels and legend text to show the text that you want. (The
 user never has to know that you changed the column name )
 
 HTH,
 Eric
 
 On Wed, Jun 23, 2021 at 9:58 PM 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?
> 
> Regards,
> Mahmood
> 
>[[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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]]
>>> 
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Special characters in cell names

2021-06-23 Thread Mahmood Naderan
Hi Bert,
I don't know what does "check.names" do here, but my commands look like


> mydata <- read.csv('r.3080..csv', header=T,row.names=1)

> head(mydata)
  W  AX/Y
P1   M  1.469734 0.004144405
P2M 20.584841 0.008010306
P3 M 53.519800 0.166034888
P4  M 42.308700 0.051545443
P5   M 99.236384 0.893037857
P6M 94.279504 0.856837525

So when I use

p <- ggplot(mydata, aes(x=W, y='X/Y')) + geom_violin(trim=FALSE)


The output is not correct. I don't see values (scale) on the y-axis.
Anyway, I fixed that with a label.

Regards,
Mahmood




On Wed, Jun 23, 2021 at 11:16 PM Bert Gunter  wrote:

> I found your specification quite vague. What did you mean by a "data file"
> -- a data frame in R? -- a file in the file system?
>
> I may be completely wrong here, but another possibility is that you read
> your data into an R data.frame via, e.g. read.table() or read.csv(), but
> failed to specify the check.names = FALSE, argument. This would cause a
> column named "x/y" in your original table to be given the name "x.y" in R,
> as "x/y" is not a syntactically valid name. See ?make.names for details.
>
> As others have already said, enclosing non-syntactically valid names in
> back ticks usually works (maybe always works??). So for example:
>
> z<-data.frame (`a/b` = 1:5, y = 1:5, check.names = FALSE)
> plot(y ~ `a/b`, data = z) ## produces desired plot with correct label
> z  ## yields:
>   a/b y
> 1   1 1
> 2   2 2
> 3   3 3
> 4   4 4
> 5   5 5
>
> Of course, ignore if this is all irrelevant.
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Wed, Jun 23, 2021 at 1:37 PM Mahmood Naderan 
> wrote:
>
>> Unfortunately, using 'X/Y' doesn't work either.
>> Instead I used labels like below
>>
>> P + scale_y_continuous(name="X/Y")
>>
>> Thanks for the suggestions.
>>
>> Regards,
>> Mahmood
>>
>>
>>
>>
>> On Wed, Jun 23, 2021 at 9:22 PM Eric Berger 
>> wrote:
>>
>> > If no one comes up with a better suggestion:
>> > a. Change the column name to "Y" so that you get the plot you want
>> > b. Use axis labels and legend text to show the text that you want. (The
>> > user never has to know that you changed the column name )
>> >
>> > HTH,
>> > Eric
>> >
>> > On Wed, Jun 23, 2021 at 9:58 PM 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?
>> >>
>> >> Regards,
>> >> Mahmood
>> >>
>> >> [[alternative HTML version deleted]]
>> >>
>> >> __
>> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> >> 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]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Special characters in cell names

2021-06-23 Thread Bert Gunter
I found your specification quite vague. What did you mean by a "data file"
-- a data frame in R? -- a file in the file system?

I may be completely wrong here, but another possibility is that you read
your data into an R data.frame via, e.g. read.table() or read.csv(), but
failed to specify the check.names = FALSE, argument. This would cause a
column named "x/y" in your original table to be given the name "x.y" in R,
as "x/y" is not a syntactically valid name. See ?make.names for details.

As others have already said, enclosing non-syntactically valid names in
back ticks usually works (maybe always works??). So for example:

z<-data.frame (`a/b` = 1:5, y = 1:5, check.names = FALSE)
plot(y ~ `a/b`, data = z) ## produces desired plot with correct label
z  ## yields:
  a/b y
1   1 1
2   2 2
3   3 3
4   4 4
5   5 5

Of course, ignore if this is all irrelevant.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Jun 23, 2021 at 1:37 PM Mahmood Naderan 
wrote:

> Unfortunately, using 'X/Y' doesn't work either.
> Instead I used labels like below
>
> P + scale_y_continuous(name="X/Y")
>
> Thanks for the suggestions.
>
> Regards,
> Mahmood
>
>
>
>
> On Wed, Jun 23, 2021 at 9:22 PM Eric Berger  wrote:
>
> > If no one comes up with a better suggestion:
> > a. Change the column name to "Y" so that you get the plot you want
> > b. Use axis labels and legend text to show the text that you want. (The
> > user never has to know that you changed the column name )
> >
> > HTH,
> > Eric
> >
> > On Wed, Jun 23, 2021 at 9:58 PM 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?
> >>
> >> Regards,
> >> Mahmood
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> __
> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> 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]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Special characters in cell names

2021-06-23 Thread Mahmood Naderan
Unfortunately, using 'X/Y' doesn't work either.
Instead I used labels like below

P + scale_y_continuous(name="X/Y")

Thanks for the suggestions.

Regards,
Mahmood




On Wed, Jun 23, 2021 at 9:22 PM Eric Berger  wrote:

> If no one comes up with a better suggestion:
> a. Change the column name to "Y" so that you get the plot you want
> b. Use axis labels and legend text to show the text that you want. (The
> user never has to know that you changed the column name )
>
> HTH,
> Eric
>
> On Wed, Jun 23, 2021 at 9:58 PM 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?
>>
>> Regards,
>> Mahmood
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Special characters in cell names

2021-06-23 Thread Eric Berger
If no one comes up with a better suggestion:
a. Change the column name to "Y" so that you get the plot you want
b. Use axis labels and legend text to show the text that you want. (The
user never has to know that you changed the column name )

HTH,
Eric

On Wed, Jun 23, 2021 at 9:58 PM 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?
>
> Regards,
> Mahmood
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Special characters in cell names

2021-06-23 Thread Duncan Murdoch

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

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Special characters in cell names

2021-06-23 Thread Bill Dunlap
Use backquotes, `X/Y`, to specify a name, not double quotes.

-Bill

On Wed, Jun 23, 2021 at 11:58 AM 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?
>
> Regards,
> Mahmood
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Special characters in cell names

2021-06-23 Thread Mahmood Naderan
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?

Regards,
Mahmood

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.