On 08/05/2013 04:45 PM, Ruth Chan wrote:
I would like to teach my students to do a simple kite diagram with some
simulated data.

...
I would like to use Altitude as a proxy for distance and I have 2 readings
for each altitude: one to the supposed right and one to the supposed left
of the transect.

...
And I’m now at a loss…would anyone be able to help?

Hi Ruth,
The kiteChart function displays a series of numeric values as widths of a polygon along some numeric dimension. You can get a kite chart of your data like this:

forest.data<-read.csv("forest.csv")
forestmat<-matrix(forest.data$Total,nrow=2,byrow=TRUE)
forestmat
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]  827  917  946  516  775  777
[2,]   22   41   52   65   78   82
kiteChart(forestmat,timelabels=forest.data$Altitude.percent[1:6]))

but I don't think that is what you want. The code below shows my guess at what you want, a comparison of "Total" by the altitude variable, using the mean of the two observations for each forest type and altitude percent.

forestdat<-matrix(forest.data[,2:3],ncol=2)
colnames(forestdat)<-c("Altitude.percent","Total")
forest.total<-matrix(c(by(forestdat[1:6,2],forestdat[1:6,1],mean),
 by(forestdat[7:12,2],forestdat[7:12,1],mean)),nrow=2,byrow=TRUE)
forest.total
     [,1]  [,2]  [,3]
[1,]  776 731.0 872.0
[2,]   80  58.5  31.5
timepos<-c(1,10,20)
kiteChart(forest.total,timelabels=timepos,
 varlabels=c("Primary","Secondary"),xlab="Altitude percent",
 ylab="Total",main="Forest kite chart")

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to