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 <[EMAIL PROTECTED]> wrote: > Dear List: > I have a dataset with over 5000 records and I would like to put the Count in > bins > based on the ForkLength. e.g. > Forklength Count > 32-34 ? > 35-37 ? > 38-40 ? > and so on... > and lastly I would like to plot (scatterplot) including the SampleDate > along the X axis and ForkLength along the Y axis. I recently saw an > example similar to this one here but I don't want a histogram I > just want to see the ForkLength ranges with different colors. For example: > ForkLength 32-34---green > ForkLength 35-37---red > ForkLength 38-40--Orange > Thanks in advance > > SampleDate ForkLength Count > 1 12/4/2007 32 2 > 2 12/6/2007 33 1 > 3 12/7/2007 33 2 > 4 12/7/2007 33 2 > 5 12/7/2007 34 1 > 6 12/9/2007 31 1 > 7 12/9/2007 33 2 > 8 12/10/2007 33 5 > 9 12/10/2007 34 1 > 10 12/11/2007 33 2 > 11 12/15/2007 34 1 > 12 12/16/2007 33 2 > 13 12/17/2007 35 1 > 14 12/19/2007 33 1 > 15 12/19/2007 35 1 > 16 12/20/2007 31 1 > 17 12/20/2007 32 1 > 18 12/20/2007 33 1 > 19 12/20/2007 34 3 > 20 12/21/2007 31 1 > 21 12/21/2007 32 3 > 22 12/21/2007 33 4 > 23 12/21/2007 34 11 > 24 12/21/2007 35 16 > 25 12/21/2007 36 3 > 26 12/21/2007 37 1 > 27 12/22/2007 32 1 > 28 12/22/2007 33 3 > 29 12/22/2007 34 1 > 30 12/22/2007 35 2 > 31 12/23/2007 32 1 > 32 12/23/2007 35 1 > 33 12/25/2007 32 1 > 34 12/25/2007 36 1 > 35 12/26/2007 34 1 > 36 12/26/2007 35 2 > 37 12/26/2007 36 1 > 38 12/27/2007 34 4 > 39 12/27/2007 35 2 > 40 12/27/2007 36 2 > 41 12/28/2007 32 1 > 42 12/28/2007 33 1 > 43 12/28/2007 34 1 > 44 12/28/2007 35 3 > 45 12/28/2007 36 4 > 46 12/28/2007 37 6 > 47 12/28/2007 38 2 > 48 12/28/2007 39 2 > 49 12/29/2007 34 1 > 50 12/29/2007 35 5 > 51 12/29/2007 36 2 > 52 12/29/2007 37 1 > 53 12/30/2007 33 3 > 54 12/30/2007 34 10 > 55 12/30/2007 35 10 > 56 12/30/2007 36 6 > 57 12/30/2007 37 15 > 58 12/30/2007 38 3 > 59 12/31/2007 33 3 > 60 12/31/2007 34 8 > 61 12/31/2007 35 9 > 62 12/31/2007 36 6 > 63 12/31/2007 37 3 > 64 12/31/2007 38 1 > 65 1/1/2008 34 6 > 66 1/1/2008 35 6 > 67 1/1/2008 35 1 > 68 1/1/2008 36 6 > 69 1/1/2008 37 9 > 70 1/1/2008 38 1 > 71 1/2/2008 34 2 > 72 1/2/2008 34 1 > 73 1/2/2008 35 2 > 74 1/2/2008 36 2 > 75 1/2/2008 37 2 > 76 1/2/2008 39 1 > 77 1/3/2008 34 3 > 78 1/3/2008 35 3 > 79 1/3/2008 36 2 > 80 1/3/2008 37 3 > 81 1/8/2008 32 1 > 82 1/8/2008 33 7 > 83 1/8/2008 34 6 > 84 1/8/2008 35 10 > 85 1/8/2008 36 16 > 86 1/8/2008 37 7 > 87 1/8/2008 38 1 > 88 1/8/2008 39 1 > 89 1/9/2008 33 1 > 90 1/9/2008 34 20 > 91 1/9/2008 35 49 > 92 1/9/2008 36 49 > 93 1/9/2008 37 39 > 94 1/9/2008 37 1 > 95 1/9/2008 38 18 > 96 1/9/2008 39 1 > 97 1/9/2008 40 1 > 98 1/10/2008 32 3 > 99 1/10/2008 33 13 > 100 1/10/2008 34 56 > 101 1/10/2008 35 33 > 102 1/10/2008 36 24 > 103 1/10/2008 37 18 > 104 1/10/2008 39 1 > 105 1/11/2008 33 7 > 106 1/11/2008 34 46 > 107 1/11/2008 35 41 > 108 1/11/2008 36 28 > 109 1/11/2008 37 29 > > Felipe D. Carrillo > Supervisory Fishery Biologist > Department of the Interior > US Fish & Wildlife Service > California, USA > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.