An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20080327/4a340640/attachment.pl
histogram for integer data
6 messages · Don MacQueen, Erwann.Rogard at sanofi-aventis.com, Henrique Dallazuanna +1 more
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
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
Hi, 1) par(ask=TRUE) histogram(~Y|F1 * F2 * F3,data = ...) Successively displays many plots as the # of levels in F3 w/o asking for input between each. In other words I only get to see the plot for the last level. What's the right commands? 2) Also I am wondering if there are plot objects i.e. something like obj<-plot(x,y) Thanks!
On 28/03/2008, Erwann.Rogard at sanofi-aventis.com
<Erwann.Rogard at sanofi-aventis.com> wrote:
Hi, 1) par(ask=TRUE) histogram(~Y|F1 * F2 * F3,data = ...) Successively displays many plots as the # of levels in F3 w/o asking for input between each. In other words I only get to see the plot for the last level. What's the right commands? 2) Also I am wondering if there are plot objects i.e. something like obj<-plot(x,y)
for this you can do: plot(x, y) x <- recordPlot() replayPlot(x)
Thanks!
______________________________________________ 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.
Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
On Fri, 28 Mar 2008, Erwann.Rogard at sanofi-aventis.com wrote:
Hi, 1) par(ask=TRUE) histogram(~Y|F1 * F2 * F3,data = ...) Successively displays many plots as the # of levels in F3 w/o asking for input between each. In other words I only get to see the plot for the last level. What's the right commands?
library(grid) ?grid.prompt. par() applies only to base graphics, and you are using grid (via lattice) here. In 2.7.0 you will use devAskNewPage() instead, and this applies to the device and not the graphics subsystem.
2) Also I am wondering if there are plot objects i.e. something like obj<-plot(x,y)
Yes, in the lattice and ggplot[2] systems, and (in a different way) in teh grid graphics subsystem they are built on.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595