[R] Binned line plot

David Winsemius dwinsemius at comcast.net
Tue Nov 22 07:07:15 CET 2011


On Nov 22, 2011, at 12:29 AM, Jeffrey Joh wrote:

>
> I have a scatter plot with 10000 points.

So you have numeric x and y values.

> I would like to add a line that bins every 50 points and connects  
> the average of each bin.

What is the rule to be applied to form these bins? You may want to  
look at ?cut and ?quantile

> I'm looking for something similar to line type "m" in Stata.

Many. perhaps most. of us do not know what that means. People complain  
about the help files for R but they are crystal clear compared with  
the help files I have seen for Stata, so I do not intend searching  
those out.

>
> With this dataset of 10000 points, I would also like to bin the data  
> and make boxplots at certain intervals,

... of what?

> so that I have a set of boxplots to represent each bin.  I would  
> also like the width of each box to be proportional to the number of  
> points in each bin.

>
> How can I make these plots?  Is there a simple package to use?

Probably any of the three plotting paradigms can be used but you need  
to describe the problem in an unambiguous manner.

>
> Jeffrey
> 		 	   		
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list