Re: [R] plotmath: unexpected SPECIAL
Folks, the relevant thing you have to remember is: All the stuff must be valid R syntax (with few additional functions as mention in the ?plotmath help file). Knowing that it is obvious where additional operators are required. Best, Uwe Ligges On 23.06.2011 02:56, Bryan Hanson wrote: Thanks to both David and Sarah. I'm glad I asked, as I had tried some of the combos Sarah suggested and observed the same behavior, which puzzled me. David, thanks for reminding me about ~ as that is a different way to get a space into the string. I just don't use plotmath often enough to become decent at it. Thanks again. Bryan On Jun 22, 2011, at 8:49 PM, David Winsemius wrote: On Jun 22, 2011, at 8:10 PM, Bryan Hanson wrote: Hello R Masters and the Rest of Us: The first of these works fine, the 2nd is accepted but too literal (the %-% is shown in the plot label and in the wrong position). The 3rd throws and error due to unexpected SPECIAL. Would someone recommend a way to format this? I want the two phrases connected by a right arrow. TIA, these things always elude me. Bryan *** Bryan Hanson Professor of Chemistry Biochemistry DePauw University xlab1 -expression(paste(Phase Angle , phi, Neat-O)) xlab2 - expression(paste(treatment: low stress, high stress, sep = %-%)) xlab3 - expression(paste(treatment: low stress, %-%, high stress)) plot(1:10, main = xlab1) plot(1:10, main = xlab2) Doesn't seem that %-% works without flanking terms xlab3 - expression(treatment*:~low~stress %-% high~stress) plot(1, main=xlab3) Or: xlab3 - expression(treatment: low stress %-% high~stress) plot(1, main=xlab3) -- David Winsemius, MD West Hartford, CT __ 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. __ 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.
Re: [R] plotmath: unexpected SPECIAL
On Thu, Jun 23, 2011 at 6:30 AM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: Folks, the relevant thing you have to remember is: All the stuff must be valid R syntax (with few additional functions as mention in the ?plotmath help file). Knowing that it is obvious where additional operators are required. Best, Uwe Ligges Actually, I think that may be the source of the confusion. I was thinking about it in terms of *labels*, and there's no intrinsic reason that an axis label or other text caption has to have x and y arguments, even if it otherwise might be an operator. A right arrow, as the original querent asked about, could have other uses in a label than connecting two items. It simply didn't occur to me that it could *only* be used that way, though in other contexts that would make perfect sense. It is only possible to use a binary operator through plotmath, even though the result is a label, and not to talk about a binary operator. That's the missing conceptual bit, at least for me. Sarah -- Sarah Goslee http://www.functionaldiversity.org __ 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.
[R] plotmath: unexpected SPECIAL
Hello R Masters and the Rest of Us: The first of these works fine, the 2nd is accepted but too literal (the %-% is shown in the plot label and in the wrong position). The 3rd throws and error due to unexpected SPECIAL. Would someone recommend a way to format this? I want the two phrases connected by a right arrow. TIA, these things always elude me. Bryan *** Bryan Hanson Professor of Chemistry Biochemistry DePauw University xlab1 -expression(paste(Phase Angle , phi, Neat-O)) xlab2 - expression(paste(treatment: low stress, high stress, sep = %-%)) xlab3 - expression(paste(treatment: low stress, %-%, high stress)) plot(1:10, main = xlab1) plot(1:10, main = xlab2) __ 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.
Re: [R] plotmath: unexpected SPECIAL
Interesting. I don't know the explanation, but look at this: # works plot(1:10, 1:10, xlab=expression(a %-% b)) # doesn't work plot(1:10, 1:10, xlab=expression(%-%)) # works plot(1:10, 1:10, xlab=expression(paste(something %-% else))) # doesn't work plot(1:10, 1:10, xlab=expression(paste(something, %-%, else))) The doesn't work examples give the same error you report: Error: unexpected SPECIAL in plot(1:10, 1:10, xlab=expression(%-% And then there's: # doesn't work, as expected plot(1:10, 1:10, xlab=expression(paste(something phi else))) # works plot(1:10, 1:10, xlab=expression(paste(something, phi, else))) # works plot(1:10, 1:10, xlab=expression(paste(something %==% else))) # doesn't work plot(1:10, 1:10, xlab=expression(paste(something, %==%, else))) So it seems that when using an expression element bracketed by percent signs, the commas in paste cause an error, even though they are otherwise necessary. Hm. This is on a clean R 2.11 session on linux (I know, but that's the latest version in the UNR repository, and I don't use R enough on this netbook to install a non-repo version). I can try again tomorrow on an up-to-date system. Sarah - Hide quoted text - On Wed, Jun 22, 2011 at 8:10 PM, Bryan Hanson han...@depauw.edu wrote: Hello R Masters and the Rest of Us: The first of these works fine, the 2nd is accepted but too literal (the %-% is shown in the plot label and in the wrong position). The 3rd throws and error due to unexpected SPECIAL. Would someone recommend a way to format this? I want the two phrases connected by a right arrow. TIA, these things always elude me. Bryan -- Sarah Goslee http://www.functionaldiversity.org __ 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.
Re: [R] plotmath: unexpected SPECIAL
On Jun 22, 2011, at 8:10 PM, Bryan Hanson wrote: Hello R Masters and the Rest of Us: The first of these works fine, the 2nd is accepted but too literal (the %-% is shown in the plot label and in the wrong position). The 3rd throws and error due to unexpected SPECIAL. Would someone recommend a way to format this? I want the two phrases connected by a right arrow. TIA, these things always elude me. Bryan *** Bryan Hanson Professor of Chemistry Biochemistry DePauw University xlab1 -expression(paste(Phase Angle , phi, Neat-O)) xlab2 - expression(paste(treatment: low stress, high stress, sep = %-%)) xlab3 - expression(paste(treatment: low stress, %-%, high stress)) plot(1:10, main = xlab1) plot(1:10, main = xlab2) Doesn't seem that %-% works without flanking terms xlab3 - expression(treatment*:~low~stress %-% high~stress) plot(1, main=xlab3) Or: xlab3 - expression(treatment: low stress %-% high~stress) plot(1, main=xlab3) -- David Winsemius, MD West Hartford, CT __ 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.
Re: [R] plotmath: unexpected SPECIAL
Thanks to both David and Sarah. I'm glad I asked, as I had tried some of the combos Sarah suggested and observed the same behavior, which puzzled me. David, thanks for reminding me about ~ as that is a different way to get a space into the string. I just don't use plotmath often enough to become decent at it. Thanks again. Bryan On Jun 22, 2011, at 8:49 PM, David Winsemius wrote: On Jun 22, 2011, at 8:10 PM, Bryan Hanson wrote: Hello R Masters and the Rest of Us: The first of these works fine, the 2nd is accepted but too literal (the %-% is shown in the plot label and in the wrong position). The 3rd throws and error due to unexpected SPECIAL. Would someone recommend a way to format this? I want the two phrases connected by a right arrow. TIA, these things always elude me. Bryan *** Bryan Hanson Professor of Chemistry Biochemistry DePauw University xlab1 -expression(paste(Phase Angle , phi, Neat-O)) xlab2 - expression(paste(treatment: low stress, high stress, sep = %-%)) xlab3 - expression(paste(treatment: low stress, %-%, high stress)) plot(1:10, main = xlab1) plot(1:10, main = xlab2) Doesn't seem that %-% works without flanking terms xlab3 - expression(treatment*:~low~stress %-% high~stress) plot(1, main=xlab3) Or: xlab3 - expression(treatment: low stress %-% high~stress) plot(1, main=xlab3) -- David Winsemius, MD West Hartford, CT __ 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.
Re: [R] plotmath: unexpected SPECIAL
Hi: From the plotmath help page: x %-% y x right-arrow y so this is behaving like a binary operator. There happen to be several of these in plotmath On Wed, Jun 22, 2011 at 5:49 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Interesting. I don't know the explanation, but look at this: # works plot(1:10, 1:10, xlab=expression(a %-% b)) # doesn't work plot(1:10, 1:10, xlab=expression(%-%)) Because there are no operands. This behavior can be replicated from the command line: 10 %/% 2 [1] 5 %/% Error: unexpected SPECIAL in %/% I think this explains the rest of the non-working examples as well, since you wouldn't do such things with binary operators. # works plot(1:10, 1:10, xlab=expression(paste(something %-% else))) # doesn't work plot(1:10, 1:10, xlab=expression(paste(something, %-%, else))) The doesn't work examples give the same error you report: Error: unexpected SPECIAL in plot(1:10, 1:10, xlab=expression(%-% And then there's: # doesn't work, as expected plot(1:10, 1:10, xlab=expression(paste(something phi else))) phi is not an operator... # works plot(1:10, 1:10, xlab=expression(paste(something, phi, else))) # works plot(1:10, 1:10, xlab=expression(paste(something %==% else))) # doesn't work plot(1:10, 1:10, xlab=expression(paste(something, %==%, else))) So it seems that when using an expression element bracketed by percent signs, the commas in paste cause an error, even though they are otherwise necessary. Hm. This is on a clean R 2.11 session on linux (I know, but that's the latest version in the UNR repository, and I don't use R enough on this netbook to install a non-repo version). I can try again tomorrow on an up-to-date system. Sarah - Hide quoted text - On Wed, Jun 22, 2011 at 8:10 PM, Bryan Hanson han...@depauw.edu wrote: Hello R Masters and the Rest of Us: The first of these works fine, the 2nd is accepted but too literal (the %-% is shown in the plot label and in the wrong position). The 3rd throws and error due to unexpected SPECIAL. Would someone recommend a way to format this? I want the two phrases connected by a right arrow. TIA, these things always elude me. Bryan -- Sarah Goslee http://www.functionaldiversity.org __ 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. __ 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.
Re: [R] plotmath: unexpected SPECIAL
Dennis, Thanks. That makes sense, but I don't think it's clearly documented. The default assumption that I and at least some others in this discussion made is that everything in the list of plotmath features in the helpfile works the same way, since they're all in the same list. And if for some of them you need paste, then you must for all. The examples weren't much help in that regard. I think there are reasons that plotmath confuses so many. Sarah On Wed, Jun 22, 2011 at 9:03 PM, Dennis Murphy djmu...@gmail.com wrote: Hi: From the plotmath help page: x %-% y x right-arrow y so this is behaving like a binary operator. There happen to be several of these in plotmath On Wed, Jun 22, 2011 at 5:49 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Interesting. I don't know the explanation, but look at this: # works plot(1:10, 1:10, xlab=expression(a %-% b)) # doesn't work plot(1:10, 1:10, xlab=expression(%-%)) Because there are no operands. This behavior can be replicated from the command line: 10 %/% 2 [1] 5 %/% Error: unexpected SPECIAL in %/% I think this explains the rest of the non-working examples as well, since you wouldn't do such things with binary operators. # works plot(1:10, 1:10, xlab=expression(paste(something %-% else))) # doesn't work plot(1:10, 1:10, xlab=expression(paste(something, %-%, else))) The doesn't work examples give the same error you report: Error: unexpected SPECIAL in plot(1:10, 1:10, xlab=expression(%-% And then there's: # doesn't work, as expected plot(1:10, 1:10, xlab=expression(paste(something phi else))) phi is not an operator... # works plot(1:10, 1:10, xlab=expression(paste(something, phi, else))) # works plot(1:10, 1:10, xlab=expression(paste(something %==% else))) # doesn't work plot(1:10, 1:10, xlab=expression(paste(something, %==%, else))) So it seems that when using an expression element bracketed by percent signs, the commas in paste cause an error, even though they are otherwise necessary. Hm. This is on a clean R 2.11 session on linux (I know, but that's the latest version in the UNR repository, and I don't use R enough on this netbook to install a non-repo version). I can try again tomorrow on an up-to-date system. Sarah - Hide quoted text - On Wed, Jun 22, 2011 at 8:10 PM, Bryan Hanson han...@depauw.edu wrote: Hello R Masters and the Rest of Us: The first of these works fine, the 2nd is accepted but too literal (the %-% is shown in the plot label and in the wrong position). The 3rd throws and error due to unexpected SPECIAL. Would someone recommend a way to format this? I want the two phrases connected by a right arrow. TIA, these things always elude me. Bryan __ 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.