Florian Defregger
2005-Sep-26 13:36 UTC
[R] histogram - one bin for all values larger than a certain value
Dear all, I wonder if I can put together a histogram where one bin contains all the values that are larger than a certain specified value. Example: I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. for the intervals [0,1), [1,2) , ..., [9,10). And then I want one last bin which contains all the values larger than 10, i.e. for the interval [10, 40). Thanks, Florian
Sundar Dorai-Raj
2005-Sep-26 14:15 UTC
[R] histogram - one bin for all values larger than a certain value
Florian Defregger wrote:> Dear all, > I wonder if I can put together a histogram where one bin contains all the > values that are larger than a certain specified value. > > Example: > I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. for > the intervals [0,1), [1,2) , ..., [9,10). And then I want one last bin which > contains all the values larger than 10, i.e. for the interval [10, 40). > > Thanks, > Florian >Hi, Florian, See the "breaks" argument in ?hist. x <- sample(1:40, 1000, replace = TRUE) hist(x, breaks = c(0:10, 40)) Is this what you intended? --sundar
Romain Francois
2005-Sep-26 14:35 UTC
[R] histogram - one bin for all values larger than a certain value
Le 26.09.2005 16:15, Sundar Dorai-Raj a ??crit :>Florian Defregger wrote: > > >>Dear all, >>I wonder if I can put together a histogram where one bin contains all the >>values that are larger than a certain specified value. >> >>Example: >>I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. for >>the intervals [0,1), [1,2) , ..., [9,10). And then I want one last bin which >>contains all the values larger than 10, i.e. for the interval [10, 40). >> >>Thanks, >>Florian >> >> >> > >Hi, Florian, > >See the "breaks" argument in ?hist. > >x <- sample(1:40, 1000, replace = TRUE) >hist(x, breaks = c(0:10, 40)) > >Is this what you intended? > >--sundar > >Maybe also take a look at the right argument. I think this is closer to what Florian wanted in the first place : R> hist(x, breaks = c(0:10, 40), right=FALSE) Romain -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques ~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ ~~~~~~ Romain FRANCOIS - http://addictedtor.free.fr ~~~~~~ ~~~~ Etudiant ISUP - CS3 - Industrie et Services ~~~~ ~~ http://www.isup.cicrp.jussieu.fr/ ~~ ~~~~ Stagiaire INRIA Futurs - Equipe SELECT ~~~~ ~~~~~~ http://www.inria.fr/recherche/equipes/select.fr.html ~~~~~~ ~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
Francisco J. Zagmutt
2005-Sep-26 20:35 UTC
[R] histogram - one bin for all values larger than a certain value
x=runif(100,0,40) hist(x, breaks=c(0,1,2,3,4,5,6,7,8,9,10,40)) Is this what you had in mind? Francisco>From: "Florian Defregger" <florian.defregger at ku-eichstaett.de> >To: <r-help at stat.math.ethz.ch> >Subject: [R] histogram - one bin for all values larger than a certain value >Date: Mon, 26 Sep 2005 15:36:21 +0200 > >Dear all, >I wonder if I can put together a histogram where one bin contains all the >values that are larger than a certain specified value. > >Example: >I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. >for >the intervals [0,1), [1,2) , ..., [9,10). And then I want one last bin >which >contains all the values larger than 10, i.e. for the interval [10, 40). > >Thanks, >Florian > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! >http://www.R-project.org/posting-guide.html