Re: [R] "Raw" histogram plots

From: Marc Schwartz <marc_schwartz_at_comcast.net>
Date: Tue, 26 Feb 2008 20:41:34 -0600

If the goal is to get a sense of the 'shape' of the overall distribution of 'x', then why not use:

   plot(density(x))

?

HTH, Marc Schwartz

Peter Alspach wrote:
> Andre
>
> If I understand you correctly, you could try a barplot() on the result
> of table().
>
> HTH ......
>
> Peter Alspach
>
>
>> -----Original Message-----
>> From: r-help-bounces_at_r-project.org
>> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Andre Nathan
>> Sent: Wednesday, 27 February 2008 1:34 p.m.
>> To: roger koenker
>> Cc: r-help
>> Subject: Re: [R] "Raw" histogram plots
>>
>> I know about stem, but the data set has 1 million points, so
>> it's not very useful here. I want to avoid binning just to
>> have an idea about the shape of the distribution, before
>> deciding how I'll bin it.
>>
>> Andre
>>
>> On Tue, 2008-02-26 at 16:20 -0600, roger koenker wrote:
>>> take a look at
>>>
>>> ?stem
>>>
>>> There is still a place for handtools in the age of integrated
>>> circuits. Of course, avoiding binning isn't really desirable.
>>>
>>>
>>> On Feb 26, 2008, at 4:10 PM, Andre Nathan wrote:
>>>
>>>> Hello
>>>>
>>>> I need to plot a histogram, but insted of using bars, I'd like to
>>>> plot the data points. I've been doing it like this so far:
>>>>
>>>> h<- hist(x, plot = F)
>>>> plot(y = x$counts / sum(x$counts),
>>>> x = x$breaks[2:length(x$breaks)],
>>>> type = "p", log = "xy")
>>>>
>>>> Sometimes I want to have a look at the "raw" data
>> (avoiding any kind
>>>> of binning). When x only contains integers, it's easy to just use
>>>> bins of size 1 when generating h with "breaks = seq(0, max(x))".
>>>>
>>>> Is there any way to do something similar when x consists of
>>>> fractional data? What I'm doing is setting a small bin
>> length (for
>>>> example, "breaks = seq(0, 1, by = 1e-6)", but there's
>> still a chance
>>>> that points will be grouped in a single bin.
>>>>
>>>> Is there a better way to do this kind of "raw histogram" plotting?
>>>>
>>>> Thanks,
>>>> Andre
>>>>



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. Received on Wed 27 Feb 2008 - 02:44:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 27 Feb 2008 - 05:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive