Re: [R] percentage sign in expression
On Wed, 2010-08-25 at 09:32 +0100, e-letter wrote: On 24/08/2010, David Winsemius dwinsemius at comcast.net wrote: On Aug 24, 2010, at 9:37 AM, e-letter wrote: Readers, According to the documentation for the function 'plotmath' there is no apparent possibility to add the percent sign (%) to a plot function, Where did you see an assertion made??? Within R I entered the command: ?plotmath Surely you don't expect the R help pages to document everything that *isn't* possible with a given function? They'd be infinitely long! ;-) No, following previous advice it would be preferable to add the following (or similar) to the documentation: 'syntax' 'meaning' ... '%' % ... What you meant to say was, ?plotmath doesn't show me how to add a % symbol to a plot. How do I do it? Also accessed using: help.start(browser=opera) Navigating the web browser page: packages packages in /usr/lib/R/library grdevices plotmath In the list headed 'syntax' and 'meaning' within the section 'details'. snip / TestChars - function(sign=1, font=1, ...) + { +if(font == 5) { sign - 1; r - c(32:126, 160:254) +} else if (l10n_info()$MBCS) r - 32:126 else r - 32:255 +if (sign == -1) r - c(32:126, 160:255) +par(pty=s) +plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, + xaxs=i, yaxs=i) +grid(17, 17, lty=1) +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...)) + } TestChars(font=5) Notice that the % sign is three characters to the right (i.e. higher) of the forall symbol that is produced by the example code I can't see 'forall' in the code above. You need to run it in R. Then you will see a plot of the glyphs available in the symbol font. 'forall' is a mathematical symbol: http://en.wikipedia.org/wiki/Table_of_mathematical_symbols they offer. (The numbering proceeds from bottom up which confused me at first.) What numbering? The numbering of the glyphs so you can use the number to draw the symbol you want. They are on the plot. You did run the code provided by David? I did not read any instruction that it was code to apply! Anyway, below is the result: TestChars - function(sign=1, font=1, ...) + + { + +if(font == 5) { sign - 1; r - c(32:126, 160:254) + +} else if (l10n_info()$MBCS) r - 32:126 else r - 32:255 Error: syntax error, unexpected '}' in: +if (sign == -1) r - c(32:126, 160:255) Error in sign == -1 : comparison (1) is possible only for atomic and list types +par(pty=s) Error in +par(pty = s) : invalid argument to unary operator +plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, + + xaxs=i, yaxs=i) Error: syntax error, unexpected EQ_ASSIGN, expecting ',' in + plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, +grid(17, 17, lty=1) Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : plot.new has not been called yet +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...)) Error: object r not found + } Error: syntax error, unexpected '}' in + } TestChars(font=5) Error: could not find function TestChars __ 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] percentage sign in expression
It's possible that my help page is different than yours. Right after the syntax/meaning description on mine (which is a Mac OSX system) is a paragraph: The symbol font uses Adobe Symbol encoding so, for example, a lower case mu can be obtained either by the special symbol mu or by symbol(m). This provides access to symbols that have no special symbol name, for example, the universal, or forall, symbol is symbol(\042). To see what symbols are available in this way useTestChars(font=5) as given in the examples for points: some are only available on some devices. (In this case I would be surprised if the help pages were different because this makes a cross-reference to the examples in points. I am not surprised about cross-platform differences in descriptions of graphical devices and would have included a caveat if I were corresponding on rhelp about such. I suppose the font issues could be platform specific so if you want to correct me on this point, I will try to file it away. I did, however, give you the code needed to to display Symbols and it sounds further on that it succeeded) I agree and seems that in this example that the documentation for graphical devices is platform dependent. This should be stated in the manual if not already. Please see previous post for the errors trying to apply the commands provided. __ 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] percentage sign in expression
On Thu, 2010-08-26 at 08:17 +0100, e-letter wrote: On Wed, 2010-08-25 at 09:32 +0100, e-letter wrote: On 24/08/2010, David Winsemius dwinsemius at comcast.net wrote: On Aug 24, 2010, at 9:37 AM, e-letter wrote: Readers, According to the documentation for the function 'plotmath' there is no apparent possibility to add the percent sign (%) to a plot function, Where did you see an assertion made??? Within R I entered the command: ?plotmath Surely you don't expect the R help pages to document everything that *isn't* possible with a given function? They'd be infinitely long! ;-) No, following previous advice it would be preferable to add the following (or similar) to the documentation: 'syntax' 'meaning' ... '%' % ... Should we also get the R devs to add 'a' a 'b' b ? This is just literal text. And as such is not what plotmath is all about, which is providing notation for common mathematical symbology. '%' is not, it is plain text. And that is handled by expression() or bquote() etc. Nothing to do with plotmath. Note that it does go into details of how to view the glyphs available with the symbol font on your machine (using the TestChars() function available in the example section of ?points ) and then plot these glyphs in both the main body of the help page and in the example. So it is documented there, but again, do you want the devs to do: 'syntax' 'Meaning' symbol(\042)FOO symbol(\043)BAR How do they handle different availability of glyphs on the various OSes that there might be etc? Hence the TestChars() and generic instructions on how to draw all glyphs in your systems symbol font. It just requires a little bit more effort on your part to find the correct \xxx code. G What you meant to say was, ?plotmath doesn't show me how to add a % symbol to a plot. How do I do it? Also accessed using: help.start(browser=opera) Navigating the web browser page: packages packages in /usr/lib/R/library grdevices plotmath In the list headed 'syntax' and 'meaning' within the section 'details'. snip / TestChars - function(sign=1, font=1, ...) + { +if(font == 5) { sign - 1; r - c(32:126, 160:254) +} else if (l10n_info()$MBCS) r - 32:126 else r - 32:255 +if (sign == -1) r - c(32:126, 160:255) +par(pty=s) +plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, + xaxs=i, yaxs=i) +grid(17, 17, lty=1) +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...)) + } TestChars(font=5) Notice that the % sign is three characters to the right (i.e. higher) of the forall symbol that is produced by the example code I can't see 'forall' in the code above. You need to run it in R. Then you will see a plot of the glyphs available in the symbol font. 'forall' is a mathematical symbol: http://en.wikipedia.org/wiki/Table_of_mathematical_symbols they offer. (The numbering proceeds from bottom up which confused me at first.) What numbering? The numbering of the glyphs so you can use the number to draw the symbol you want. They are on the plot. You did run the code provided by David? I did not read any instruction that it was code to apply! Anyway, below is the result: TestChars - function(sign=1, font=1, ...) + + { + +if(font == 5) { sign - 1; r - c(32:126, 160:254) + +} else if (l10n_info()$MBCS) r - 32:126 else r - 32:255 Error: syntax error, unexpected '}' in: +if (sign == -1) r - c(32:126, 160:255) Error in sign == -1 : comparison (1) is possible only for atomic and list types +par(pty=s) Error in +par(pty = s) : invalid argument to unary operator +plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, + + xaxs=i, yaxs=i) Error: syntax error, unexpected EQ_ASSIGN, expecting ',' in + plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, +grid(17, 17, lty=1) Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : plot.new has not been called yet +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...)) Error: object r not found + } Error: syntax error, unexpected '}' in + } TestChars(font=5) Error: could not find function TestChars __ 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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
Re: [R] percentage sign in expression
On 24/08/2010, David Winsemius dwinsem...@comcast.net wrote: On Aug 24, 2010, at 9:37 AM, e-letter wrote: Readers, According to the documentation for the function 'plotmath' there is no apparent possibility to add the percent sign (%) to a plot function, Where did you see an assertion made??? Within R I entered the command: ?plotmath Also accessed using: help.start(browser=opera) Navigating the web browser page: packages packages in /usr/lib/R/library grdevices plotmath In the list headed 'syntax' and 'meaning' within the section 'details'. e.g. plot(a[,1]~b[,2],ylab=expression(x~%),xlab=expression(z)) How to achieve this please? Read the plotmath helo page more carefully. The section immediatedly below the plotmath expressions points you to the use of the symbol() expression-function and to the points help page where generation of the available glyphs proceeds according to the advice on help(plotmath): In my system the paragraph immediately after the list of features (i.e. 'syntax','meaning') describes a note to TeX users. I cannot see reference to 'symbol()'. TestChars - function(sign=1, font=1, ...) + { +if(font == 5) { sign - 1; r - c(32:126, 160:254) +} else if (l10n_info()$MBCS) r - 32:126 else r - 32:255 +if (sign == -1) r - c(32:126, 160:255) +par(pty=s) +plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, + xaxs=i, yaxs=i) +grid(17, 17, lty=1) +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...)) + } TestChars(font=5) Notice that the % sign is three characters to the right (i.e. higher) of the forall symbol that is produced by the example code I can't see 'forall' in the code above. they offer. (The numbering proceeds from bottom up which confused me at first.) What numbering? The documentation makes reference to the command: demo(plotmath) I applied this command and could not see an instruction to produce the percent (%) symbol. __ 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] percentage sign in expression
On Wed, 2010-08-25 at 09:32 +0100, e-letter wrote: On 24/08/2010, David Winsemius dwinsem...@comcast.net wrote: On Aug 24, 2010, at 9:37 AM, e-letter wrote: Readers, According to the documentation for the function 'plotmath' there is no apparent possibility to add the percent sign (%) to a plot function, Where did you see an assertion made??? Within R I entered the command: ?plotmath Surely you don't expect the R help pages to document everything that *isn't* possible with a given function? They'd be infinitely long! ;-) What you meant to say was, ?plotmath doesn't show me how to add a % symbol to a plot. How do I do it? Also accessed using: help.start(browser=opera) Navigating the web browser page: packages packages in /usr/lib/R/library grdevices plotmath In the list headed 'syntax' and 'meaning' within the section 'details'. snip / TestChars - function(sign=1, font=1, ...) + { +if(font == 5) { sign - 1; r - c(32:126, 160:254) +} else if (l10n_info()$MBCS) r - 32:126 else r - 32:255 +if (sign == -1) r - c(32:126, 160:255) +par(pty=s) +plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, + xaxs=i, yaxs=i) +grid(17, 17, lty=1) +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...)) + } TestChars(font=5) Notice that the % sign is three characters to the right (i.e. higher) of the forall symbol that is produced by the example code I can't see 'forall' in the code above. You need to run it in R. Then you will see a plot of the glyphs available in the symbol font. 'forall' is a mathematical symbol: http://en.wikipedia.org/wiki/Table_of_mathematical_symbols they offer. (The numbering proceeds from bottom up which confused me at first.) What numbering? The numbering of the glyphs so you can use the number to draw the symbol you want. They are on the plot. You did run the code provided by David? Anyway, is there a problem with this: plot(1:10, xlab = expression(foo == 15*%)) That way you don't need to worry about finding the right glyph. HTH G The documentation makes reference to the command: demo(plotmath) I applied this command and could not see an instruction to produce the percent (%) symbol. __ 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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] percentage sign in expression
On Aug 25, 2010, at 4:32 AM, e-letter wrote: On 24/08/2010, David Winsemius dwinsem...@comcast.net wrote: On Aug 24, 2010, at 9:37 AM, e-letter wrote: Readers, According to the documentation for the function 'plotmath' there is no apparent possibility to add the percent sign (%) to a plot function, Where did you see an assertion made??? Within R I entered the command: ?plotmath Also accessed using: help.start(browser=opera) Navigating the web browser page: packages packages in /usr/lib/R/library grdevices plotmath In the list headed 'syntax' and 'meaning' within the section 'details'. e.g. plot(a[,1]~b[,2],ylab=expression(x~%),xlab=expression(z)) How to achieve this please? Read the plotmath helo page more carefully. The section immediatedly below the plotmath expressions points you to the use of the symbol() expression-function and to the points help page where generation of the available glyphs proceeds according to the advice on help(plotmath): In my system the paragraph immediately after the list of features (i.e. 'syntax','meaning') describes a note to TeX users. I cannot see reference to 'symbol()'. It's possible that my help page is different than yours. Right after the syntax/meaning description on mine (which is a Mac OSX system) is a paragraph: The symbol font uses Adobe Symbol encoding so, for example, a lower case mu can be obtained either by the special symbol mu or by symbol(m). This provides access to symbols that have no special symbol name, for example, the universal, or forall, symbol is symbol(\042). To see what symbols are available in this way useTestChars(font=5) as given in the examples for points: some are only available on some devices. (In this case I would be surprised if the help pages were different because this makes a cross-reference to the examples in points. I am not surprised about cross-platform differences in descriptions of graphical devices and would have included a caveat if I were corresponding on rhelp about such. I suppose the font issues could be platform specific so if you want to correct me on this point, I will try to file it away. I did, however, give you the code needed to to display Symbols and it sounds further on that it succeeded) TestChars - function(sign=1, font=1, ...) + { +if(font == 5) { sign - 1; r - c(32:126, 160:254) +} else if (l10n_info()$MBCS) r - 32:126 else r - 32:255 +if (sign == -1) r - c(32:126, 160:255) +par(pty=s) +plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, + xaxs=i, yaxs=i) +grid(17, 17, lty=1) +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...)) + } TestChars(font=5) Notice that the % sign is three characters to the right (i.e. higher) of the forall symbol that is produced by the example code I can't see 'forall' in the code above. Gavin has already explained why you did not. The upside-down A (== universal or forall) was a useful reference point in the indexing, since it is only 3 glyphs away for the % symbol. they offer. (The numbering proceeds from bottom up which confused me at first.) What numbering? Actually I did not see any numbering either, which was why I remained confused about the location of the % symbol for several minutes. Perhaps I should have used the term indexing. The documentation makes reference to the command: demo(plotmath) I applied this command and could not see an instruction to produce the percent (%) symbol. I don't think I suggested it would. -- 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] percentage sign in expression
You've tried: plot(a[,1]~b[,2],ylab=expression(x~'%'),xlab=expression(z)) ? On Tue, Aug 24, 2010 at 10:37 AM, e-letter inp...@gmail.com wrote: Readers, According to the documentation for the function 'plotmath' there is no apparent possibility to add the percent sign (%) to a plot function, e.g. plot(a[,1]~b[,2],ylab=expression(x~%),xlab=expression(z)) How to achieve this please? yours, rh...@conference.jabber.org r251 mandriva2009 __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ 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] percentage sign in expression
On 24/08/2010, Henrique Dallazuanna www...@gmail.com wrote: You've tried: plot(a[,1]~b[,2],ylab=expression(x~'%'),xlab=expression(z)) ? This is successful for me, thank you. This instruction should be added to the documentation for 'plotmath'. __ 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] percentage sign in expression
On Aug 24, 2010, at 9:37 AM, e-letter wrote: Readers, According to the documentation for the function 'plotmath' there is no apparent possibility to add the percent sign (%) to a plot function, Where did you see an assertion made??? e.g. plot(a[,1]~b[,2],ylab=expression(x~%),xlab=expression(z)) How to achieve this please? Read the plotmath helo page more carefully. The section immediatedly below the plotmath expressions points you to the use of the symbol() expression-function and to the points help page where generation of the available glyphs proceeds according to the advice on help(plotmath): TestChars - function(sign=1, font=1, ...) + { +if(font == 5) { sign - 1; r - c(32:126, 160:254) +} else if (l10n_info()$MBCS) r - 32:126 else r - 32:255 +if (sign == -1) r - c(32:126, 160:255) +par(pty=s) +plot(c(-1,16), c(-1,16), type=n, xlab=, ylab=, + xaxs=i, yaxs=i) +grid(17, 17, lty=1) +for(i in r) try(points(i%%16, i%/%16, pch=sign*i, font=font,...)) + } TestChars(font=5) Notice that the % sign is three characters to the right (i.e. higher) of the forall symbol that is produced by the example code they offer. (The numbering proceeds from bottom up which confused me at first.) So: plot(1, ylab=expression(symbol(\045) )) -- 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.