[R] what the problem could be if i am suddenly unable to add abline to the scatter plot?

David Winsemius dwinsemius at comcast.net
Wed May 12 19:16:09 CEST 2010


On May 12, 2010, at 11:57 AM, xin wei wrote:

>
> I am doing very regular stuff like the following:
>
>
> attach(wtana)
>
> fm<- lm(Body.Wt.on.SD1~Heart.Wt, data=wtana)
> #fm<- lm(wtana$Body.Wt.on.SD1~wtana$Heart.Wt)
> lrf<- loess(Body.Wt.on.SD1~Heart.Wt, wtana)
> #lrf<- loess(wtana$Body.Wt.on.SD1~wtana$Heart.Wt)
>
> plot(Body.Wt.on.SD1,Heart.Wt)
> #plot(wtana$Body.Wt.on.SD1,wtana$Heart.Wt)
> #lines(spline(Heart.Wt,fitted(lrf)), col=2)
> abline(fm, col=4)
>
> however, the abline just refuse to to show up in the scatter cloud.
> Does anyone has clue?

I don't know that abline has a method for lm objects.

 > methods(abline)
no methods were found
Warning message:
In methods(abline) : function 'abline' appears not to be generic

  Have you tried using coef(lm) as your argument to abline? (Untested  
in the absence of a cut-and-pastable example.)

> thanks
--

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list