[R] contour & persp
Andrew Wang
hellangel_987 at yahoo.com
Sun Feb 7 22:46:49 CET 2010
I have this data set that both x & y are ordered vectors of length 600 & 700 respectively; z is a 600 by 700 matrix whose entry z[i,j] is either a missing value (indicated by 'NaN') or a real number between 0 and 1. The contour function
contour(x,y,z)
gives me a blank picture. I guess the reason is that most of z-entries are missing, only less than 1% are non missing.
Question (1)
Is there a way that I could manipulate the data or function to have the non-missing values plotted?
Also, trying function "persp" gives me this error message
persp(x,y,z)
Error in persp.default(x, y, z) : invalid 'z' limits
I look at the manual of "persp". I guess, the error message comes from its internal call
zlim = range(z, na.rm = TRUE)
it appears to me that "persp" can't handle missing value yet its manual states clearly
z: a matrix containing the values to be plotted ('NA's are
allowed). Note that ‘x’ can be used instead of ‘z’
for convenience.
Question (2)
Can "persp" handle missing values in z? if the answer is a sounding "yes", how should I do in my case?
Please help, Thanks!
Your frustrated
Andrew
More information about the R-help
mailing list