Re: [R] histogram for integer data

From: <Erwann.Rogard_at_sanofi-aventis.com>
Date: Thu, 27 Mar 2008 16:02:20 -0400

Thanks!

Yes, but I also want to be able to condition easily hence histogram(...), not plot

-----Original Message-----
From: Don MacQueen [mailto:macq_at_llnl.gov] Sent: Thursday, March 27, 2008 3:55 PM
To: Rogard, Erwann R&D/US/EXT; r-help_at_r-project.org Subject: Re: [R] histogram for integer data

You might consider something based on the concept of:

   y <- table( x)
   plot( as.numeric(names(y)) , y, type='h')

-Don

At 2:59 PM -0400 3/27/08, <Erwann.Rogard_at_sanofi-aventis.com> wrote:
>hi,
>
>library(lattice)
>x<-c(-1,-1,-1,0,0,0,0,1,1,2)
>rng<-range(x)
>histogram(x,endpoints=c(rng[1]-0.5,rng[2]+0.5),nint=length(unique(x)))
>
>instead of contiguous bins, i'd like spaces between them to indicate
>that the data is discrete, or even better, line segments positioned at
>integer values.
>i know how to do this with plot, but i need it with histogram, so that
>in more complicated contexts i can use histogram(~x| f1 * f2....)
>
>thanks!
>
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>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.

--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062

______________________________________________
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 Thu 27 Mar 2008 - 20:04:59 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 Thu 27 Mar 2008 - 20:30:24 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