[R] Beginner Question on Persp()

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Mon Feb 5 14:58:45 CET 2007


Tom H. wrote:
> I recently downloaded R for Windows, running on Win XP.  I'm trying to create
> a perspective plot but not having any luck after reading the R manual and
> several examples found on the Internet.
>
> I have a 100 x 100 matrix of Z data as a tab-delimited text file exported
> from Minitab.  I read this in to R using read.delim; this seemed to go ok. 
> I created  X and Y using seq() to get 100 divisions for the X and Y axes. 
> Again, everything looked good, when I typed X or Y I got a string of 100
> numbers.
>
> However, when I try to do persp(x,y,z) I get an error something like: (list)
> cannot be coerced to double.  I know the basic data (matrix of z values) is
> ok (no hidden non-numeric values) because Minitab will graph it just fine. 
> Any suggestions on how to proceed?  Thanks in advanced for your help.
>   
Data frames are not matrices. Presumably, you want as.matrix(z).

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list