[R] Graph binned data

Jeffrey Joh johjeffrey at hotmail.com
Mon Nov 7 06:09:53 CET 2011


I have a table that looks like this:

structure(list(speed = c(3,9,14,8,7,6), result = c(0.697, 0.011, 0.015, 0.012, 0.018, 0.019), house = c(1, 
1, 1, 1, 1, 1), date = c(719, 1027, 1027, 1027, 1030, 1030), 
    id = c("1000", "10000", 
    "10001", "10002", "10003", "10004")), .Names = c("speed", 
"result", "house", "date", "id"), class = "data.frame", row.names = c("1000", 
"10000", "10001", "10002", "10003", "10004"))

I would like to bin the data by speed, 0-4, 5-9, 10-14, 15-20, etc.  Then I would like to make a graph of speed vs result.  The graph should show the average result of each bin, and error bars to represent the standard deviation of the result in each bin.  What kind of code can I use to make this?

Jeffrey
 		 	   		  


More information about the R-help mailing list