[R] Levels of a vector for a contour plot

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Apr 6 00:12:24 CEST 2000


Art Salwin <salwin at mitretek.org> writes:

> Is there something more elegant than
> 
> xlevels<-as.numeric(levels(factor(x)))
> 
> to get the levels found in vector x?  xlevels will be used
> to generate
> a contour plot as in
> contour(xlevels,ylevels,zvals)
> 
> where zvals<-tapply(z,list(x,y),mean)

How about sort(unique(x)) ?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list