Hi All,

I would like to have an idea of how I can solve this error.

I am getting the following error in plotting:

> abline(regn,col='red',lwd=1.5 , data=BUTemp)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
  plot.new has not been called yet

This is the str of my data set

> str(BUTemp)
'data.frame':    7671 obs. of  6 variables:
 $ Year : int  1971 1971 1971 1971 1971 1971 1971 1971 1971 1971 ...
 $ Month: Factor w/ 12 levels "Aug","Sep","Oct",..: 2 2 2 2 2 2 2 2 2 2 ...
 $ Day  : int  1 2 3 4 5 6 7 8 9 10 ...
 $ Rain : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Tmax : num  24.3 25 25.6 26.5 27.8 27.5 25.7 25.1 26.5 25.1 ...
 $ Tmin : num  13.5 13.2 12.7 12.7 12.2 14 13.2 12.3 12.8 11.7 ...

The code I am using is :

require(latticeExtra) # trellis plot for temperature and rain.
require(lattice)

levels(BUTemp$Month) <- c("Aug", "Sep", "Oct", "Nov", "Dec", "Jan",
                          "Feb", "Mar", "Apr", "May", "Jun", "Jul")

xyplot(BUTemp$Tmin + BUTemp$Tmax ~ BUTemp$Year | BUTemp$Month,
       data =BUTemp , type = "b", pch=19)

regn=lm(BUTemp$Tmin + BUTemp$Tmax ~ BUTemp$Year)

abline(regn,col='red',lwd=1.5)
summary(regn)

Thanks  for your help.

Regards,
Frederic.
Frederic Ntirenganya
Maseno University,
African Maths Initiative,
Kenya.
Mobile:(+254)718492836
Email: fr...@aims.ac.za
https://sites.google.com/a/aims.ac.za/fredo/

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to