Hello,
Maybe this time you've got it wrong, Arun. The op wants to sum the
areas, not just label them.
Using your code,
Range=cut(dat1$Percent, breaks=c(-Inf,0, 25, 50, 75, 100),
labels=c("<=0", "0-25", "25-50", "50-75", ">75"))
aggregate(Area ~ Range, data = dat1, FUN = sum)
# Range
HI,
Infact, there is no need for aggregate().
dat1$range<-cut(dat3$Percent,breaks=c(-Inf,0,25,50,75,100),labels=c("<=0","0-25","25-50","50-75",">75"))
dat1
# Area Percent range
#1 456 0 <=0
#2 3400 10 0-25
#3 79 25 0-25
#4 56 18 0-25
#5 467 0 <=0
#6 67
Hi,
I guess this is what you wanted:
dat1<-read.table(text="
Area Percent
456 0
3400 10
79 25
56 18
467 0
67 67
839 85
1120 0
3482 85
",sep="",header=TRUE)
aggregate(dat1$Percent, list(Area = dat1[,"Area"],Range=cut(dat1
$Pe
3 matches
Mail list logo