[R] Scatter plot from tapply output, labels of data

monaR mfu001 at uit.no
Mon Sep 3 19:33:20 CEST 2012


Hei,
i am trying to plot the means of two variables (d13C and d15N), by 2
grouping factors (Species and Year) that i obtained by the function tapply.
I would like to plot with different colours according to the Year and show
the "Species" as data labels.
My data looks like this:

Species          d13C    d13N    Year
"Species1"    14,4       11.5     2009
"Species2"       ...            ...       ....

>Nmean<-tapply(d15N,list(Year,Species),mean)
>Cmean<-tapply(d13C,list(Year,Species),mean) 

##works fine, returns something like this

          Species1         Species2         Species3
2009 20.3                  13.4                 13,5
2011 NA                     23.5                 14.5
2012 11.3                   NA                    23.4

>plot(Cmean,Nmean,col=c("green","red","blue"),....)

#works fine, gives a plot with data points coloured by "Year"

>text(Cmean,Nmean,labels=levels(Species),cex=.7,adj=c(-.1,-.6))

#does not work, mixes up the labels, have tried Species<-as.factor(Species)
and switched tapply(d15N,list(Year,Species),mean)
to-->tapply(d15N,list(Species,Year),mean) which gives the Years as column
names but does not produce a better plot. The

I cannot find the error, any idea what i am doing wrong????
Thanks sooo much



--
View this message in context: http://r.789695.n4.nabble.com/Scatter-plot-from-tapply-output-labels-of-data-tp4642077.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list