[R] Re: FW: Contour v Contourplot
mark at myatt.demon.co.uk
Fri May 31 13:56:52 CEST 2002
>> Using x,y, and z variables in the enclosed test.RData, the command
>> produces a lovely 2D plot, whereas
>> produces the error..
>> Error in if (lim > lim) stop("Improper value of limit") :
>> missing value where logical needed
>> Any ideas what I'm doing wrong? Many thanks..
Well this took a bit of thought as I am not familiar with lattice. Gave
me the prod I needed to look at it and it was well worth the look.
The lattice functions seem want to have a data.frame rather than a list
of vectors. It doesn't say that in the docs (not that I found but I
didn't look far) so I did:
phils.data <- expand.grid(x = x, y = y)
phils.data$z <- z
contourplot(z ~ x * y, data = phils.data)
And it worked. The trick is to use expand.grid() to create data.frame
containing one row for each combination x and y and then add z to that.
I think that is what you want.
Before plots to get rid of the grey background ... better, IMHO)
I think the problem posting to R-Help might be down to your sending an
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help