Skip to content
Prev 155534 / 398502 Next

Binning

This should do what you want.

#--x <- read.table('clipboard', header=TRUE, as.is=TRUE)
# convert dates
x$date <- as.POSIXct(strptime(x$SampleDate, "%m/%d/%Y"))
# put ForkLength into bins
x$bins <- cut(x$ForkLength, breaks=c(32, 34, 37, 40), include.lowest=TRUE)
# count the bins
tapply(x$Count, x$bins, sum)
# plot the data
plot(x$date, x$ForkLength, col=c('green', 'red', 'orange')[x$bins])






On Tue, Sep 9, 2008 at 3:12 PM, Felipe Carrillo
<mazatlanmexico at yahoo.com> wrote: