[R] sort data.frame and contour()

Tord Snall tord.snall at ebc.uu.se
Thu Oct 4 14:51:48 CEST 2001


Dear all,

I would like to know if there is a function for sorting a data.frame based
on one column. sort() does it for a single vector but not for the whole
data. order() does it if there are relations between the columns but in my
case it is simply a data.frame.

Further, I would like to plot other data,

pop.size<- c(800, 800, 1500, 1000, 158, 300, 740, 250, 2000, 1500, 250, 700)
fem.frek<- c(0.054, 0.099, 0.04, 0.113, 0.234, 0.241, 0.099, 0.182, 0.176,
0.175, 0.126, 0.09)
rel.femfec<- c(0.975, 0.713, 1.035, 1.745, 0.77, 1.162, 0.94, 0.636, 2.12,
2.159, 0.428, 1.217)
emil.data<- as.data.frame(cbind(pop.size, fem.frek,asfem.frek,rel.femfec))
attach(emil.data)
contour(pop.size, fem.frek, matrix(rel.femfec, ncol=length(fem.frek)))

using contour() but I get an error message and read 

   x,y: locations of grid lines at which the values in `z' are
          measured.  These must be in ascending order.  By default,
    
Must a model be fitted first and the model then plotted, or am I missing
something essential?


Thanks in advance!

Sincerely,
Tord Snäll


-----------------------------------------------------------------------
Tord Snäll
Avd. f växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet
Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala University
Villavägen 14			
SE-752 36 Uppsala, Sweden
Tel: 018-471 28 82 (int +46 18 471 28 82) (work)
Tel: 018-25 71 33 (int +46 18 25 71 33) (home)
Fax: 018-55 34 19 (int +46 18 55 34 19) (work)
E-mail: Tord.Snall at ebc.uu.se
http://www.vaxtbio.uu.se/resfold/snall.htm
------------------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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