Graham Smith <graham.smith <at> myotis.co.uk> writes:

> 
> Although, I can fix this, I am trying to sort out something as 
> straighforward as possible for my students, and I have some questions 
> that hopefully someone can help me with.
> 
> My data is:
> 
> Species       Distance        Count
> A     5               0
> A     10              5
> A     15              5
> A     20              3
> A     25              1
> B     5               8
> B     10              20
> B     15              28
> B     20              12
> B     25              12
> C     5               5
> C     10              12
> C     15              19
> C     20              27
> C     25              34
> 
> But I am struggling to get this into a data frame that does what I 
> expect. I have tried various arrangements.
> 
> What I am hoping for is:
> 
> an x-axis labelled "Distance" with tick marks at 0, 5, 10,15,20 and 25.
> 
> And, an y-axis labelled "Species" and tick marks labelled A, B and C.
> 
> So I would appreciate some help on how the data should be prepared for 
> kiteChart, to maximise the lablels being added automatically. If possible.
> 
> Many thanks,
> 
> Graham
> 
> 

####
X <- read.table(textConnection("Species Distance        Count
A       5               0
A       10              5
A       15              5
A       20              3
A       25              1
B       5               8
B       10              20
B       15              28
B       20              12
B       25              12
C       5               5
C       10              12
C       15              19
C       20              27
C       25              34"),header=TRUE)

library(reshape)
X2 <- recast(X,Distance~Species,id.var=1:2)
X3 <- as.matrix(X2[,-1])
rownames(X3) <- X2$Distance
colnames(X3) <- names(X2)[-1]
library(plotrix)
kiteChart(t(X3),xlab="Distance",ylab="Species")

______________________________________________
[email protected] 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