Skip to content
Prev 67542 / 398506 Next

How to plot Contour with NA in dataframe

WeiQiang.Li at seagate.com wrote:
Your problem isn't the NA values, it's the fact that the contour 
functions want a matrix, and you're passing a data.frame.  If you use 
as.matrix on it, it converts to character mode, presumably because your 
last column is entirely missing (so is read as mode logical, not numeric).

Use this massaging on it and the plot will work:

  myData <- as.matrix(as.data.frame(lapply(myData,as.numeric)))

Duncan Murdoch