[R] Expression for pedices

2007-04-15 Thread Cressoni, Massimo \(NIH/NHLBI\) [F]

I know that this maybe a trivial question. I am not able to plot pedices in 
graph axes.
Instead I am able to plot different math symbols :

XLABEL - expression(paste(cmH,lim(f(x), x %-% 0),O PEEP))
works well

XLABEL - expression(paste(cmH,[2],O PEEP))
is considered a wrong expression.

Thanks

__
[EMAIL PROTECTED] 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] Expression for pedices

2007-04-15 Thread Duncan Murdoch
On 4/15/2007 2:05 PM, Cressoni, Massimo (NIH/NHLBI) [F] wrote:
 I know that this maybe a trivial question. I am not able to plot pedices in 
 graph axes.
 Instead I am able to plot different math symbols :

I think you mean subscripts.

 
 XLABEL - expression(paste(cmH,lim(f(x), x %-% 0),O PEEP))
 works well
 
 XLABEL - expression(paste(cmH,[2],O PEEP))
 is considered a wrong expression.

Yes, you don't want the comma before the bracket:

XLABEL - expression(paste(cmH[2],O PEEP))

Duncan Murdoch

__
[EMAIL PROTECTED] 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] expression()

2006-12-13 Thread javier garcia-pintado
Thanks you,
this works right.

I just would like to note one thing:
although I've found italic() in the help for plotmath and I can see that
the italic function:

mtext(expression(italic(beta)[max]),side=1,line=2)

does not work on the greek beta character.

Though not strictly necessary, this would be perfect for my plots, as I
use them for papers to be published.

Wishes,
Javier
--
Benilton Carvalho wrote:
 mtext(expression(beta[max]), side=1, line=2)

 is it what you want?

 b

 On Dec 12, 2006, at 10:59 AM, javier garcia-pintado wrote:

 Hi,
 I'm trying to use expression() to write a text to a graphic in the 
 margin.

 Using:

 mtext(expression(beta),side=1,line=2)

 writes a perfect beta greek character, but I need to add a subindex
 max, and I'm trying:

 mtext(paste(expression(beta),max),side=1,line=2)

 simply writes beta max in the plot.

 Please, Could you tell me what I'm doing wrong?

 By the way, is there a way to add Latex expressions to graphics?  Then I
 could use the Latex expression: $\beta_{\mathrm{max}}$. This also  would
 be very useful for me for more complex expressions in plots.

 Best regards,

 Javier

 -- 
 Javier García-Pintado
 Institute of Earth Sciences Jaume Almera (CSIC)
 Lluis Sole Sabaris s/n, 08028 Barcelona
 Phone: +34 934095410
 Fax:   +34 934110012
 e-mail:[EMAIL PROTECTED]

 __
 R-help@stat.math.ethz.ch 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.




-- 
Javier García-Pintado
Institute of Earth Sciences Jaume Almera (CSIC)
Lluis Sole Sabaris s/n, 08028 Barcelona
Phone: +34 934095410
Fax:   +34 934110012
e-mail:[EMAIL PROTECTED] 

__
R-help@stat.math.ethz.ch 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] expression()

2006-12-13 Thread Prof Brian Ripley
On Wed, 13 Dec 2006, javier garcia-pintado wrote:

 Thanks you,
 this works right.

 I just would like to note one thing:
 although I've found italic() in the help for plotmath and I can see that
 the italic function:

 mtext(expression(italic(beta)[max]),side=1,line=2)

 does not work on the greek beta character.

No, and there is no italic symbol font in the R graphics model so no means 
of plotting such a symbol.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch 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] expression()

2006-12-13 Thread Paul Murrell
Hi


javier garcia-pintado wrote:
 Thanks you,
 this works right.
 
 I just would like to note one thing:
 although I've found italic() in the help for plotmath and I can see that
 the italic function:
 
 mtext(expression(italic(beta)[max]),side=1,line=2)
 
 does not work on the greek beta character.
 
 Though not strictly necessary, this would be perfect for my plots, as I
 use them for papers to be published.


Take a look at
http://www.stat.auckland.ac.nz/~paul/Talks/fonts.pdf
(and maybe http://www.stat.auckland.ac.nz/~paul/Talks/fonts.tar.gz)
especially the latter half on mathematical formulas in plots, which
shows an example of using TeX fonts in R plots.
It includes links to further materials and explanations.

Paul


 Wishes,
 Javier
 --
 Benilton Carvalho wrote:
 mtext(expression(beta[max]), side=1, line=2)

 is it what you want?

 b

 On Dec 12, 2006, at 10:59 AM, javier garcia-pintado wrote:

 Hi,
 I'm trying to use expression() to write a text to a graphic in the 
 margin.

 Using:

 mtext(expression(beta),side=1,line=2)

 writes a perfect beta greek character, but I need to add a subindex
 max, and I'm trying:

 mtext(paste(expression(beta),max),side=1,line=2)

 simply writes beta max in the plot.

 Please, Could you tell me what I'm doing wrong?

 By the way, is there a way to add Latex expressions to graphics?  Then I
 could use the Latex expression: $\beta_{\mathrm{max}}$. This also  would
 be very useful for me for more complex expressions in plots.

 Best regards,

 Javier

 -- 
 Javier García-Pintado
 Institute of Earth Sciences Jaume Almera (CSIC)
 Lluis Sole Sabaris s/n, 08028 Barcelona
 Phone: +34 934095410
 Fax:   +34 934110012
 e-mail:[EMAIL PROTECTED]

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

__
R-help@stat.math.ethz.ch 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] expression()

2006-12-12 Thread javier garcia-pintado
Hi,
I'm trying to use expression() to write a text to a graphic in the margin.

Using:

mtext(expression(beta),side=1,line=2)

writes a perfect beta greek character, but I need to add a subindex
max, and I'm trying:

mtext(paste(expression(beta),max),side=1,line=2)

simply writes beta max in the plot.

Please, Could you tell me what I'm doing wrong?

By the way, is there a way to add Latex expressions to graphics? Then I
could use the Latex expression: $\beta_{\mathrm{max}}$. This also would
be very useful for me for more complex expressions in plots.

Best regards,

Javier

-- 
Javier García-Pintado
Institute of Earth Sciences Jaume Almera (CSIC)
Lluis Sole Sabaris s/n, 08028 Barcelona
Phone: +34 934095410
Fax:   +34 934110012
e-mail:[EMAIL PROTECTED] 

__
R-help@stat.math.ethz.ch 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] expression()

2006-12-12 Thread Benilton Carvalho
mtext(expression(beta[max]), side=1, line=2)

is it what you want?

b

On Dec 12, 2006, at 10:59 AM, javier garcia-pintado wrote:

 Hi,
 I'm trying to use expression() to write a text to a graphic in the  
 margin.

 Using:

 mtext(expression(beta),side=1,line=2)

 writes a perfect beta greek character, but I need to add a subindex
 max, and I'm trying:

 mtext(paste(expression(beta),max),side=1,line=2)

 simply writes beta max in the plot.

 Please, Could you tell me what I'm doing wrong?

 By the way, is there a way to add Latex expressions to graphics?  
 Then I
 could use the Latex expression: $\beta_{\mathrm{max}}$. This also  
 would
 be very useful for me for more complex expressions in plots.

 Best regards,

 Javier

 -- 
 Javier García-Pintado
 Institute of Earth Sciences Jaume Almera (CSIC)
 Lluis Sole Sabaris s/n, 08028 Barcelona
 Phone: +34 934095410
 Fax:   +34 934110012
 e-mail:[EMAIL PROTECTED]

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] expression()

2006-12-12 Thread Scionforbai
Hallo,

for the first question:
mtext(expression(beta[max]),side=1,line=2)

and:
?plotmath
demo(plotmath)
for the second.

Hope it helped,
Scionforbai

__
R-help@stat.math.ethz.ch 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] Expression

2006-11-30 Thread Guenther, Cameron
Hi all,
I have a question about expression.

In a figure I want to include the term D*obs with the star as as
superscript and obs as subscript.  I have even just tried to get the
star to be superscript.

 
The code I tried was 
text(Dstar+7,120,expression(paste({}D,^*))), but that doesn't work and I
get a syntax error.
 
I can't seem to find anything in the help files that explains it.
 
Thanks in advance.

Cameron Guenther, Ph.D.
100 8th Ave. SE
St. Petersburg, Fl 33701
727-896-8626 ext. 4305
[EMAIL PROTECTED] 
__
R-help@stat.math.ethz.ch 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] Expression

2006-11-30 Thread Gabor Grothendieck
Try:

plot(1, main = ~ D[obs]^*)

On 11/30/06, Guenther, Cameron [EMAIL PROTECTED] wrote:
 Hi all,
 I have a question about expression.

 In a figure I want to include the term D*obs with the star as as
 superscript and obs as subscript.  I have even just tried to get the
 star to be superscript.


 The code I tried was
 text(Dstar+7,120,expression(paste({}D,^*))), but that doesn't work and I
 get a syntax error.

 I can't seem to find anything in the help files that explains it.

 Thanks in advance.

 Cameron Guenther, Ph.D.
 100 8th Ave. SE
 St. Petersburg, Fl 33701
 727-896-8626 ext. 4305
 [EMAIL PROTECTED]


 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] Expression

2006-11-30 Thread Barry Rowlingson
Guenther, Cameron wrote:

 The code I tried was 
 text(Dstar+7,120,expression(paste({}D,^*))), but that doesn't work and I
 get a syntax error.
  
 I can't seem to find anything in the help files that explains it.

   plot(1:10)
   text(8,5,expression(D[obs]^*))

works for me...

Barry

__
R-help@stat.math.ethz.ch 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] Expression

2006-11-30 Thread Peter Dalgaard
Guenther, Cameron wrote:
 Hi all,
 I have a question about expression.

 In a figure I want to include the term D*obs with the star as as
 superscript and obs as subscript.  I have even just tried to get the
 star to be superscript.

  
 The code I tried was 
 text(Dstar+7,120,expression(paste({}D,^*))), but that doesn't work and I
 get a syntax error.
  
 I can't seem to find anything in the help files that explains it.
   
Well, ?plotmath does say

 A mathematical expression must obey the normal rules of syntax for
 any R expression, but it is interpreted according to very
 different rules than for normal R expressions.

which should at least explain why you get a syntax error from the above 
code. Beyond that, you do need to understand how R's syntax rules work, 
including at least a feel for how expressions are represented 
internally, and how that influences the plotting of expressions.

The easiest solution is probably expression(D^*)

__
R-help@stat.math.ethz.ch 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] expression() - Superscript in y-axis, keeping line break in string

2006-08-04 Thread Andrew Kniss
I've tried several different ways to accomplish this, but as yet to no
avail.  My y-axis for a plot has a rather long label, and thus I have
been using /n to break it into two lines.  However, to make it
technically correct for publication, I also need to use superscript in
the label.  For example:

 par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
 plot(1:10,
  ylab=14C-glyphosate line1\n line2)

will provide the text in two lines as I would like it.  However, I am
trying to keep those same line breaks when using expression() to get my
superscript number.  This will not work, as it aligns the 14C section
with the bottom line of the expression making little sense to the
reader.

 par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
 plot(1:10,
  ylab=expression( ^14*C*-glyphosate line1\n line2))

Is there a way to align the 14C portion of the expression with the top
line of the string rather than the bottom line?  Any suggestions are
greatly appreciated.
Andrew


-- 
Andrew Kniss
Assistant Research Scientist
University of Wyoming 
Department of Plant Sciences

[EMAIL PROTECTED]
Office: (307) 766-3949
Fax:(307) 766-5549

__
R-help@stat.math.ethz.ch 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] expression() - Superscript in y-axis, keeping line break in string

2006-08-04 Thread Marc Schwartz (via MN)
On Fri, 2006-08-04 at 09:47 -0600, Andrew Kniss wrote:
 I've tried several different ways to accomplish this, but as yet to no
 avail.  My y-axis for a plot has a rather long label, and thus I have
 been using /n to break it into two lines.  However, to make it
 technically correct for publication, I also need to use superscript in
 the label.  For example:
 
  par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
  plot(1:10,
   ylab=14C-glyphosate line1\n line2)
 
 will provide the text in two lines as I would like it.  However, I am
 trying to keep those same line breaks when using expression() to get my
 superscript number.  This will not work, as it aligns the 14C section
 with the bottom line of the expression making little sense to the
 reader.
 
  par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
  plot(1:10,
   ylab=expression( ^14*C*-glyphosate line1\n line2))
 
 Is there a way to align the 14C portion of the expression with the top
 line of the string rather than the bottom line?  Any suggestions are
 greatly appreciated.
 Andrew

plotmath, as has been covered many times previously, does not support
multi-line expressions. A note should probably be added to ?plotmath on
this.

Thus, you need to create each line in the label separately:

  par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
  
  plot(1:10, ylab = )

  # Now use mtext() to place each line of the y axis label

  mtext(2, text = expression( ^14*C*-glyphosate line1), line = 3)

  mtext(2, text = line2, line = 2)

See ?mtext for more information.

HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch 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] expression() - Superscript in y-axis, keeping line break in string

2006-08-04 Thread Gabor Grothendieck
Use atop:

   plot(1, main = expression(atop( ^14*C*-glyphosate line, line2)))

On 8/4/06, Andrew Kniss [EMAIL PROTECTED] wrote:
 I've tried several different ways to accomplish this, but as yet to no
 avail.  My y-axis for a plot has a rather long label, and thus I have
 been using /n to break it into two lines.  However, to make it
 technically correct for publication, I also need to use superscript in
 the label.  For example:

 par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
 plot(1:10,
  ylab=14C-glyphosate line1\n line2)

 will provide the text in two lines as I would like it.  However, I am
 trying to keep those same line breaks when using expression() to get my
 superscript number.  This will not work, as it aligns the 14C section
 with the bottom line of the expression making little sense to the
 reader.

 par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
 plot(1:10,
  ylab=expression( ^14*C*-glyphosate line1\n line2))

 Is there a way to align the 14C portion of the expression with the top
 line of the string rather than the bottom line?  Any suggestions are
 greatly appreciated.
 Andrew


 --
 Andrew Kniss
 Assistant Research Scientist
 University of Wyoming
 Department of Plant Sciences

 [EMAIL PROTECTED]
 Office: (307) 766-3949
 Fax:(307) 766-5549

 __
 R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] expression() - Superscript in y-axis, keeping line break in string

2006-08-04 Thread Gabor Grothendieck
Sorry, you wanted a ylab=, not a main=.  Try using xyplot in lattice:

library(lattice)
xyplot(1~1, ylab = expression(atop(phantom(0)^14*C*-glyphosate line,
line2)))


On 8/4/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Use atop:

   plot(1, main = expression(atop( ^14*C*-glyphosate line, line2)))

 On 8/4/06, Andrew Kniss [EMAIL PROTECTED] wrote:
  I've tried several different ways to accomplish this, but as yet to no
  avail.  My y-axis for a plot has a rather long label, and thus I have
  been using /n to break it into two lines.  However, to make it
  technically correct for publication, I also need to use superscript in
  the label.  For example:
 
  par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
  plot(1:10,
   ylab=14C-glyphosate line1\n line2)
 
  will provide the text in two lines as I would like it.  However, I am
  trying to keep those same line breaks when using expression() to get my
  superscript number.  This will not work, as it aligns the 14C section
  with the bottom line of the expression making little sense to the
  reader.
 
  par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
  plot(1:10,
   ylab=expression( ^14*C*-glyphosate line1\n line2))
 
  Is there a way to align the 14C portion of the expression with the top
  line of the string rather than the bottom line?  Any suggestions are
  greatly appreciated.
  Andrew
 
 
  --
  Andrew Kniss
  Assistant Research Scientist
  University of Wyoming
  Department of Plant Sciences
 
  [EMAIL PROTECTED]
  Office: (307) 766-3949
  Fax:(307) 766-5549
 
  __
  R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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] expression() - Superscript in y-axis, keeping line break in string

2006-08-04 Thread Marc Schwartz (via MN)
Actually Gabor, using your solution with 'atop', which I had not
considered, it will work with base graphics:

 par(oma = c(0, 0, 2, 0), mar = c(5, 6, 0.25, 2), lheight = 1)

 plot(1:10, ylab = expression(atop( ^14*C*-glyphosate line1,
   line2)))

HTH,

Marc

On Fri, 2006-08-04 at 12:09 -0400, Gabor Grothendieck wrote:
 Sorry, you wanted a ylab=, not a main=.  Try using xyplot in lattice:
 
 library(lattice)
 xyplot(1~1, ylab = expression(atop(phantom(0)^14*C*-glyphosate line,
 line2)))
 
 
 On 8/4/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
  Use atop:
 
plot(1, main = expression(atop( ^14*C*-glyphosate line, line2)))
 
  On 8/4/06, Andrew Kniss [EMAIL PROTECTED] wrote:
   I've tried several different ways to accomplish this, but as yet to no
   avail.  My y-axis for a plot has a rather long label, and thus I have
   been using /n to break it into two lines.  However, to make it
   technically correct for publication, I also need to use superscript in
   the label.  For example:
  
   par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
   plot(1:10,
ylab=14C-glyphosate line1\n line2)
  
   will provide the text in two lines as I would like it.  However, I am
   trying to keep those same line breaks when using expression() to get my
   superscript number.  This will not work, as it aligns the 14C section
   with the bottom line of the expression making little sense to the
   reader.
  
   par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
   plot(1:10,
ylab=expression( ^14*C*-glyphosate line1\n line2))
  
   Is there a way to align the 14C portion of the expression with the top
   line of the string rather than the bottom line?  Any suggestions are
   greatly appreciated.
   Andrew
  

__
R-help@stat.math.ethz.ch 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] expression() - Superscript in y-axis, keeping line break in string

2006-08-04 Thread Prof Brian Ripley
On Fri, 4 Aug 2006, Marc Schwartz (via MN) wrote:

 On Fri, 2006-08-04 at 09:47 -0600, Andrew Kniss wrote:
  I've tried several different ways to accomplish this, but as yet to no
  avail.  My y-axis for a plot has a rather long label, and thus I have
  been using /n to break it into two lines.  However, to make it
  technically correct for publication, I also need to use superscript in
  the label.  For example:
  
   par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
   plot(1:10,
ylab=14C-glyphosate line1\n line2)
  
  will provide the text in two lines as I would like it.  However, I am
  trying to keep those same line breaks when using expression() to get my
  superscript number.  This will not work, as it aligns the 14C section
  with the bottom line of the expression making little sense to the
  reader.
  
   par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
   plot(1:10,
ylab=expression( ^14*C*-glyphosate line1\n line2))
  
  Is there a way to align the 14C portion of the expression with the top
  line of the string rather than the bottom line?  Any suggestions are
  greatly appreciated.
  Andrew
 
 plotmath, as has been covered many times previously, does not support
 multi-line expressions. A note should probably be added to ?plotmath on
 this.

I've added a note.  I think what is exact is that control chars are not 
interpreted ('expresssion' is an overloaded work in this context).

Thanks for the nudge (and please do continue to make such remarks).

Brian

 
 Thus, you need to create each line in the label separately:
 
   par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
   
   plot(1:10, ylab = )
 
   # Now use mtext() to place each line of the y axis label
 
   mtext(2, text = expression( ^14*C*-glyphosate line1), line = 3)
 
   mtext(2, text = line2, line = 2)
 
 See ?mtext for more information.
 
 HTH,
 
 Marc Schwartz
 
 __
 R-help@stat.math.ethz.ch 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.
 

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch 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] expression() - Superscript in y-axis, keeping line break in string

2006-08-04 Thread Marc Schwartz (via MN)
On Fri, 2006-08-04 at 19:44 +0100, Prof Brian Ripley wrote:
 On Fri, 4 Aug 2006, Marc Schwartz (via MN) wrote:
 
  On Fri, 2006-08-04 at 09:47 -0600, Andrew Kniss wrote:
   I've tried several different ways to accomplish this, but as yet to no
   avail.  My y-axis for a plot has a rather long label, and thus I have
   been using /n to break it into two lines.  However, to make it
   technically correct for publication, I also need to use superscript in
   the label.  For example:
   
par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
plot(1:10,
 ylab=14C-glyphosate line1\n line2)
   
   will provide the text in two lines as I would like it.  However, I am
   trying to keep those same line breaks when using expression() to get my
   superscript number.  This will not work, as it aligns the 14C section
   with the bottom line of the expression making little sense to the
   reader.
   
par(oma=c(0,0,2,0),mar=c(5,6,0.25,2),lheight=1)
plot(1:10,
 ylab=expression( ^14*C*-glyphosate line1\n line2))
   
   Is there a way to align the 14C portion of the expression with the top
   line of the string rather than the bottom line?  Any suggestions are
   greatly appreciated.
   Andrew
  
  plotmath, as has been covered many times previously, does not support
  multi-line expressions. A note should probably be added to ?plotmath on
  this.
 
 I've added a note.  I think what is exact is that control chars are not 
 interpreted ('expresssion' is an overloaded work in this context).
 
 Thanks for the nudge (and please do continue to make such remarks).
 
 Brian

snip

Happy to help and thanks for both noticing and taking the time to
incorporate the update.

Best regards,

Marc

__
R-help@stat.math.ethz.ch 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] execute R expression from command line

2005-09-08 Thread Omar Lakkis
Can I execute an R expression from the command line without having it
in an infile, something like perl's -e flag. So it would look like:

R {Rexpression;}  outfile

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] execute R expression from command line

2005-09-08 Thread Seth Falcon
On  8 Sep 2005, [EMAIL PROTECTED] wrote:

 Can I execute an R expression from the command line without having
 it in an infile, something like perl's -e flag. So it would look
 like:

 R {Rexpression;}  outfile

With a bash-like shell, you can do:

echo library(foo); somefunc(5) | R --slave 

HTH,

+ seth

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R: expression

2005-07-19 Thread Clark Allan
hi all

i am having a problem with the expression/paste command

say we estimate a variable, named PHI

it contains the value of say 2

and we want to display this value as  hat(phi) = PHI onto a graphic

i.e.  hat(phi)=2 

how does one do this?

i've tried the following:

1.  legend(-5,.3,expression(hat(phi)*=*PHI))

2.  legend(-5,.3,paste(expression(phi),=,PHI))

but they do not work.

any help?

/
allan__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] R: expression

2005-07-19 Thread Uwe Ligges
Clark Allan wrote:

 hi all
 
 i am having a problem with the expression/paste command
 
 say we estimate a variable, named PHI
 
 it contains the value of say 2
 
 and we want to display this value as  hat(phi) = PHI onto a graphic
 
 i.e.hat(phi)=2 
 
 how does one do this?
 
 i've tried the following:
 
 1.legend(-5,.3,expression(hat(phi)*=*PHI))
 
 2.legend(-5,.3,paste(expression(phi),=,PHI))


See ?plotmath or the Help Desk Article Automation of Mathematical 
Annotation in Plots in R News 2 (3), 32-34.

 legend(-5, .3, substitute(hat(phi) == PHI, list(PHI = PHI)))

Uwe Ligges


 but they do not work.
 
 any help?
 
 /
 allan
 
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R: expression

2005-07-19 Thread Adaikalavan Ramasamy
Something like this :

 x - 0.5
 plot( 1:10, main=substitute( hat(Phi) ~ = ~ x, list(x=x) ) )

Also see http://tolstoy.newcastle.edu.au/R/help/04/09/3371.html

Regards, Adai



On Tue, 2005-07-19 at 13:35 +0200, Clark Allan wrote:
 hi all
 
 i am having a problem with the expression/paste command
 
 say we estimate a variable, named PHI
 
 it contains the value of say 2
 
 and we want to display this value as  hat(phi) = PHI onto a graphic
 
 i.e.hat(phi)=2 
 
 how does one do this?
 
 i've tried the following:
 
 1.legend(-5,.3,expression(hat(phi)*=*PHI))
 
 2.legend(-5,.3,paste(expression(phi),=,PHI))
 
 but they do not work.
 
 any help?
 
 /
 allan
 __ R-help@stat.math.ethz.ch 
 mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the 
 posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R: expression

2005-07-19 Thread Thomas Lumley
On Tue, 19 Jul 2005, Uwe Ligges wrote:

 Clark Allan wrote:

 hi all
 i am having a problem with the expression/paste command
 say we estimate a variable, named PHI
 it contains the value of say 2
 and we want to display this value as  hat(phi) = PHI onto a graphic
 i.e.   hat(phi)=2 
 how does one do this?



 legend(-5, .3, substitute(hat(phi) == PHI, list(PHI = PHI)))


or
  legend(-5, .3, bquote(hat(phi) == .(PHI)))


-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Expression in panel.text

2005-04-22 Thread David Orme
Hi,
I've got a lattice xyplot and I want to superimpose correlation 
coefficients and p values on each panel. I've been trying to get this 
to work using something of the form:

x - rnorm(400)
y - rnorm(400)
a - gl(4, 100)
xyplot(y~x | a,
panel=function(x,y, ...){
panel.xyplot(x,y, ...)
curr.cor - cor.test(x,y)
crho - round(curr.cor$estimate,2)
cpv - format.pval(curr.cor$p.value, eps = 0.01, digits=2)
exprrho - substitute(rho == crho, list(crho=crho))
exprpv - substitute(italic(p) == cpv, list(cpv=cpv))
panel.text(-2, 2, label=exprrho)
panel.text(2, 2, label=exprpv)
})
The two expressions (expprho and exprpv) plot as expected on a normal 
text() call  but in the panels, all that appears at the coordinates is 
==. This is the first element in exprrho; other than that,  I can't 
figure out what is going wrong.

Any suggestions?
Thanks in advance.
David
 version
 _
platform powerpc-apple-darwin6.8
arch powerpc
os   darwin6.8
system   powerpc, darwin6.8
status
major2
minor0.0
year 2004
month10
day  04
language R
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Expression in panel.text

2005-04-22 Thread Deepayan Sarkar
On Friday 22 April 2005 10:12, David Orme wrote:
 Hi,

 I've got a lattice xyplot and I want to superimpose correlation
 coefficients and p values on each panel. I've been trying to get this
 to work using something of the form:

 x - rnorm(400)
 y - rnorm(400)
 a - gl(4, 100)

 xyplot(y~x | a,
   panel=function(x,y, ...){
panel.xyplot(x,y, ...)
  curr.cor - cor.test(x,y)
  crho - round(curr.cor$estimate,2)
  cpv - format.pval(curr.cor$p.value, eps = 0.01, digits=2)
  exprrho - substitute(rho == crho, list(crho=crho))
  exprpv - substitute(italic(p) == cpv, list(cpv=cpv))
  panel.text(-2, 2, label=exprrho)
   panel.text(2, 2, label=exprpv)
  })

 The two expressions (expprho and exprpv) plot as expected on a normal
 text() call  but in the panels, all that appears at the coordinates is
 ==. This is the first element in exprrho; other than that,  I can't
 figure out what is going wrong.

 Any suggestions?

I believe this came up a few days back. 

 exprrho - substitute(rho == crho, list(crho=.12))
 is.expression(exprrho)
[1] FALSE

i.e., the label you are using is not an expression. The 'panel.text' you have 
didn't take this possibility into account (unlike 'text').

The good news is that this has been fixed in R 2.1.0.

Deepayan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] expression + paste + arguments + ...

2004-07-30 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:
dear R wizards:  I would like to write a function that roughly places 
the equivalent of the following latex text into the current plot:

  \newcommand{ \placesigma }[4]{ \put(\#1,\#2){ \sigma_{A , #3} = #4 }
???
You are just defining a new LaTeX command ... nothing will be printed 
in LaTeX.

Instead of using \put, you can specify coordinates as usual in R using 
text(), title() or mtext().
Instead of \sigma_{A , #3} = #4, you can use

  substitute(sigma[v3] == v4, list(v3 = paste(A,,v3), v4 = v4))
which leads to, e.g.
  plot(1:10)
  v3 - 99
  v4 - 55
  text(4, 1, label = substitute(sigma[v3] == v4,
 list(v3 = paste(A,,v3), v4 = v4)))
See also ?plotmath and the R Help Desk Column in R News 2 (3).
Uwe Ligges

I cannot figure out how to do this.  I know I have to use a function 
that uses expressions in a text() invoke.  But passing arguments and 
nesting strings and expressions has so far not worked for me.  I hope 
this is an obvious question---if not, please just tell me and I can give 
up.  help appreciated.

sincerely,
/iaw
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] expression + paste + arguments + ...

2004-07-29 Thread ivo_welch-rstat8783
dear R wizards:  I would like to write a function that roughly places 
the equivalent of the following latex text into the current plot:

  \newcommand{ \placesigma }[4]{ \put(\#1,\#2){ \sigma_{A , #3} = #4 }
I cannot figure out how to do this.  I know I have to use a function 
that uses expressions in a text() invoke.  But passing arguments and 
nesting strings and expressions has so far not worked for me.  I hope 
this is an obvious question---if not, please just tell me and I can 
give up.  help appreciated.

sincerely,
/iaw
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] expression + paste + arguments + ...

2004-07-29 Thread Spencer Graves
 I don't know latex, but have you looked at ?plotmath, including 
'demo(plotmath)', the examples in the documentation, and an R site 
search suggested in the posting guide 
(http://www.R-project.org/posting-guide.html)?  What you want is 
probably fairly easy, once you parse the plotmath documentation.  hope 
this helps.  spencer graves

[EMAIL PROTECTED] wrote:
dear R wizards:  I would like to write a function that roughly places 
the equivalent of the following latex text into the current plot:

  \newcommand{ \placesigma }[4]{ \put(\#1,\#2){ \sigma_{A , #3} = #4 }
I cannot figure out how to do this.  I know I have to use a function 
that uses expressions in a text() invoke.  But passing arguments and 
nesting strings and expressions has so far not worked for me.  I hope 
this is an obvious question---if not, please just tell me and I can 
give up.  help appreciated.

sincerely,
/iaw
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] expression with running index

2004-04-25 Thread Tamas Papp
Hi,

I need a list of expression of the form expression(b[i]), where i is a
running index.  So for example, if i - -1:2, I would like to have a
list equivalent to

list(expression(b[-1]), expression(b[0]), expression(b[1]), expression(b[2]))

i might be a character vector (like c(f, g, h))

Could somebody help me out by writing a function that produces the
list above for a given string in place of b and a vector of subscripts?

Sorry if this has been discussed before, I tried searching the
archives but expression as a keyword gives too many results on
different subjects.

Thanks,

Tamas

-- 
Tamás K. Papp
E-mail: [EMAIL PROTECTED]
Please try to send only (latin-2) plain text, not HTML or other garbage.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] expression with running index

2004-04-25 Thread Uwe Ligges
Tamas Papp wrote:

Hi,

I need a list of expression of the form expression(b[i]), where i is a
running index.  So for example, if i - -1:2, I would like to have a
list equivalent to
list(expression(b[-1]), expression(b[0]), expression(b[1]), expression(b[2]))

i might be a character vector (like c(f, g, h))

Could somebody help me out by writing a function that produces the
list above for a given string in place of b and a vector of subscripts?
Sorry if this has been discussed before, I tried searching the
archives but expression as a keyword gives too many results on
different subjects.
Thanks,

Tamas

For example:

 lapply(as.double(-1:2), function(x) substitute(b[i], i = list(i=x)))

Uwe Ligges

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] expression with running index

2004-04-25 Thread Prof Brian Ripley
lapply(-1:2, function(i) substitute(expression(b[i]), list(i=i)))

would be a good start. (Note that what it gives is

[[1]]
expression(b[as.integer(-1)])

which is not what you asked for but is what I think you intended.

Then we can elaborate this to 

f - function(ind, vec)
lapply(ind, 
   function(i, vec) substitute(expression(vec[i]), 
   list(i=i, vec=vec)), 
   vec=as.name(vec))

f(-1:2, b) and f(c(f, g, h), b) both work

Also, I am not sure you need the expression() in there, as without it you 
have a language call which will almost certainly do.


On Sun, 25 Apr 2004, Tamas Papp wrote:

 Hi,
 
 I need a list of expression of the form expression(b[i]), where i is a
 running index.  So for example, if i - -1:2, I would like to have a
 list equivalent to
 
 list(expression(b[-1]), expression(b[0]), expression(b[1]), expression(b[2]))
 
 i might be a character vector (like c(f, g, h))
 
 Could somebody help me out by writing a function that produces the
 list above for a given string in place of b and a vector of subscripts?
 
 Sorry if this has been discussed before, I tried searching the
 archives but expression as a keyword gives too many results on
 different subjects.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] expression for simple EM

2003-02-23 Thread Vumani Dlamini
Dear R users,

I know this is the wrong forum for such a question but I need help.

I would like to write down the likelihood expression for a simple EM 
problem. I have one categorical covariate with 5 levels and a missing count 
which can fall in any of the categories. I know the solution to the problem 
but can't seem to get the likelihood expression correct (if it is possible).

Thanks.

Vumani Dlamini, Student
Faculty of Health Sciences
University of Natal
__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help