[R] Plotting polynomial fit

2009-04-26 Thread Ronnen Levinson
Hi.

Is there an analog to abline() that can be used to plot a polynomial fit?

For example, I can draw the straight-line fit

fit - lm(y ~ x)

via

abline(coef=fit$coef)

but I'm not sure how to draw the polynomial fit

fit - lm(y ~ poly(x,2))

I do see the function curve(), but not how to prepare an expr for 
curve() based on the coefficients returned by the polynomial fit.

Thanks for your help,

/Ronnen.

/P.S. E-mailed CCs of posted replies appreciated.

[[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.


[R] Converting 1-D array to vector

2008-08-26 Thread Ronnen Levinson

   Hi.
   How  do I convert a one-dimensional array of characters to a character
   vector? In the example below I am trying to get the result c(a,d). The
   function as.vector() returns the same one-dimensional array, and unlist()
   returns something more complicated than I seek.
   Yours truly,
   Ronnen.
   P.S. E-mailed CCs of posted replies appreciated.
df=data.frame(x=letters[1:3],y=letters[4:6])
df
 x y
   1 a d
   2 b e
   3 c f
df[1,]
 x y
   1 a d
as.vector(df[1,])
 x y
   1 a d
unlist(df[1,])
   x y
   a d
   Levels: a b c d e f
c(a,d) # desired result
   [1] a d
version
  _
   platform   i386-pc-mingw32
   arch   i386
   os mingw32
   system i386, mingw32
   status
   major  2
   minor  7.0
   year   2008
   month  04
   day22
   svn rev45424
   language   R
   version.string R version 2.7.0 (2008-04-22)

   --
   Ronnen Levinson, Ph.D.
   scientist, Lawrence Berkeley National Lab
   The  Onion  horoscope: Libra September 23 - October 23 Your tactics of
   overwhelming your opposition with spectacular shows of force and choking the
   roads with fleeing refugees will be seen as inappropriate by the other
   electronics wholesalers.
__
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] Text shrinking in pdf graphics

2008-05-04 Thread Ronnen Levinson

__
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.