[R] Creating vegetation distance groups from one column
arun
smartpink111 at yahoo.com
Fri Oct 5 13:33:11 CEST 2012
Hi,
Try this:
data.to.analyze<-read.table(text="
Area Veg
456 0
3400 10
79 25
56 18
467 4
67 7
839 30
1120 16
3482 32
",sep="",header=TRUE)
data.to.analyze$VegIndex=cut(data.to.analyze
$Veg,breaks=c(-5,0,5,10,15,20,25,30,35),
labels=c("(-5-0)", "(1-5)", "(6-10)", "(11-15)", "(16-20)","(21-25)","(26-30)","(31-35)"))
VegIndex <- data.to.analyze$VegIndex
plot(VegIndex)
A.K.
----- Original Message -----
From: Jhope <jeanwaijang at gmail.com>
To: r-help at r-project.org
Cc:
Sent: Friday, October 5, 2012 3:38 AM
Subject: Re: [R] Creating vegetation distance groups from one column
Thank you! That has worked for me when creating graphs. In plyr I used the
script:
# Veg Index
data.to.analyze$VegIndex <- cut(data.to.analyze$Veg,
breaks=seq(0, 35, 5), include.lowest=TRUE)
VegIndex <- data.to.analyze$VegIndex
plot(VegIndex)
But the vegetation distances on the x-axis in the graph are showing up as:
[-5,0] (0,5] (5,10] (10,15] (15,20] (20,25] (25,30]
I am concerned these vegetation classes are not grouped probably and there
is overlap between the classes. It should read, preferably without brackets
or only one kind ():
(-5-0) (1-5) (6-10) (11-15) (16-20) (21-25) (26-30)
How do I fix this?
Please advise, Jean
--
View this message in context: http://r.789695.n4.nabble.com/Creating-vegetation-distance-groups-from-one-column-tp4644970p4645127.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at 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.
More information about the R-help
mailing list