An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130604/2ff373c8/attachment.pl>
Expression evaluation of Plotting labels containing spaces
6 messages · Pascal Oettli, David Winsemius, Santosh
Hello,
Example not reproducible:
> exc <- list(units=list( c(m^2)) ,vars= list(c('asb')), ,label=
list(c('abs surf body')))
Error: object 'm' not found
Regards,
Pascal
On 05/06/13 11:39, Santosh wrote:
Dear Rxperts,
How do I overcome the anomaly as in the second case of examples below?
exc <- list(units=list( c(m^2)) ,vars= list(c('asb')), ,label= list(c('abs
surf body')))
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'
(',exc$units[1],')',sep='')))
plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'
(',exc$units[1],')',sep='')))
Thanks so much!
Santosh
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.
Hi, On possibility is: par(mfrow=c(2,1), mar=c(5.1,5.1,4.1,2.1)) plot(1,1, ylab=expression(a.s.b.~(m^2))) plot(1,1, ylab=expression(abs~surf~body~(m^2))) Regards, Pascal
On 05/06/13 11:39, Santosh wrote:
Dear Rxperts,
How do I overcome the anomaly as in the second case of examples below?
exc <- list(units=list( c(m^2)) ,vars= list(c('asb')), ,label= list(c('abs
surf body')))
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'
(',exc$units[1],')',sep='')))
plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'
(',exc$units[1],')',sep='')))
Thanks so much!
Santosh
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.
On Jun 4, 2013, at 8:39 PM, Santosh wrote:
Dear Rxperts,
How do I overcome the anomaly as in the second case of examples below?
exc <- list(units=list( c(m^2)) ,vars= list(c('asb')), ,label=
list(c('abs
surf body')))
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'
(',exc$units[1],')',sep='')))
plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'
(',exc$units[1],')',sep='')))
Mail client mangled this due entirely to your improper use HTML. You
have been posting to Rhelp long enough to have had plenty of
opportunity to read the Posting Guide. And I know for a fact that it
is quite easy to send plain text using gmail. You have no legitimate
excuse for continuing this deprecated practice.
Anyway, running this code:
exc <- list(units=list( c("m^2")) ,vars= list(c('asb')), label=
list(c('abs surf body')))
# Notice that I quoted the 'units' value
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'(',exc
$units[1],')',sep='')))
# Also note that plotmath cannot handle embedded carriage returns
plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'(',exc
$units[1],')',sep='')))
Produces this error:
Error in parse(text = paste(exc$label[1], "(", exc$units[1], ")", sep
= "")) :
<text>:1:5: unexpected symbol
1: abs surf
^
(You are asked in the Posting Guide exactly your code and also to post
your error messages.)
So you are trying to parse an expression and the parser is expecting a
comma or a tilde or .... something other than the beginning of
another token. You never said what you actually wanted (also a request
in the Posting Guide), but try adding tilde's:
exc <- list(units=list( c("m^2")) ,vars= list(c('asb')), label=
list(c('abs~surf~body')))
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'(',exc
$units[1],')',sep='')))
plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'(',exc
$units[1],')',sep='')))
I know that the plotmath help page is not exactly the most expansive
regarding how to form proper expressions for R but at least review it
and run the examples:
?plotmath
David. > > Thanks so much! > > Santosh > > [[alternative HTML version deleted]] Sigh. > > > R-help at 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. --- David Winsemius, MD Alameda, CA, USA
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130604/0c151830/attachment.pl>
Hello, ?plotmath -> See Also demo(plotmath) Regards, Pascal
On 05/06/13 15:00, Santosh wrote:
Thanks so much!! Would be it be better if in vignette of plotmath, x %~% y and x~~y; likewise, other operations (.e.g., x %*% y, x * y) may be grouped, so that are not missed by a layman like me! - just a thought... Thanks, Santosh On Tue, Jun 4, 2013 at 9:13 PM, David Winsemius <dwinsemius at comcast.net>wrote:
On Jun 4, 2013, at 8:39 PM, Santosh wrote: Dear Rxperts,
How do I overcome the anomaly as in the second case of examples below?
exc <- list(units=list( c(m^2)) ,vars= list(c('asb')), ,label= list(c('abs
surf body')))
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'
(',exc$units[1],')',sep='')))
plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'
(',exc$units[1],')',sep='')))
Mail client mangled this due entirely to your improper use HTML. You have
been posting to Rhelp long enough to have had plenty of opportunity to read
the Posting Guide. And I know for a fact that it is quite easy to send
plain text using gmail. You have no legitimate excuse for continuing this
deprecated practice.
Anyway, running this code:
exc <- list(units=list( c("m^2")) ,vars= list(c('asb')), label=
list(c('abs surf body')))
# Notice that I quoted the 'units' value
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'(',exc$**
units[1],')',sep='')))
# Also note that plotmath cannot handle embedded carriage returns
plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'(',exc$**
units[1],')',sep='')))
Produces this error:
Error in parse(text = paste(exc$label[1], "(", exc$units[1], ")", sep =
"")) :
<text>:1:5: unexpected symbol
1: abs surf
^
(You are asked in the Posting Guide exactly your code and also to post
your error messages.)
So you are trying to parse an expression and the parser is expecting a
comma or a tilde or .... something other than the beginning of another
token. You never said what you actually wanted (also a request in the
Posting Guide), but try adding tilde's:
exc <- list(units=list( c("m^2")) ,vars= list(c('asb')), label=
list(c('abs~surf~body')))
plot(1:10,1:10, ylab=parse(text= paste(exc$vars[1],'(',exc$**
units[1],')',sep='')))
plot(1:10,1:10, ylab=parse(text= paste(exc$label[1],'(',exc$**
units[1],')',sep='')))
I know that the plotmath help page is not exactly the most expansive
regarding how to form proper expressions for R but at least review it and
run the examples:
?plotmath
--
David.
Thanks so much!
Santosh
[[alternative HTML version deleted]]
Sigh.
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html <http://www.R-project.org/posting-guide.html>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^**^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^** ^^^^^^^^^^^^^
and provide commented, minimal, self-contained, reproducible code. --- David Winsemius, MD Alameda, CA, USA
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.