[R] Help with Hist

Ivan Calandra ivan.calandra at uni-hamburg.de
Mon Nov 15 16:08:47 CET 2010


Hi,

I think you should also give the upper extreme:

x <- c(rnorm(80)+10, 101:110, 2001:2010)
hist(x, breaks=c(0, 20, 40, 60, 80, 100, 200, 500))
Error in hist.default(x, breaks = c(0, 20, 40, 60, 80, 100, 200, 500)) :
   some 'x' not counted; maybe 'breaks' do not span range of 'x'
hist(x, breaks=c(0, 20, 40, 60, 80, 100, 200, 500, 2100))  ## which 
looks horrible, but works, up to you how to cut it

HTH,
Ivan

Le 11/15/2010 15:53, Steve Sidney a écrit :
> Dear list
>
> I am trying to re-scale a histogram and using hist() but can not seem 
> to create a reduced scale where the upper values are not plotted.
>
> What I have is about 100 of which 80 or so are between a value of 0 
> and 40 , one or two in the hundreds and an outlier around 2000.
>
> What I would like to do is create an x-scale that shows 5 bins between 
> 0-100 and then 3/4 bins between 100 and 2000 but I don't need any 
> resolution on the above 100 values.
>
> If I use breaks c(0, 20, 40, 60, 80, 100, 200, 500) R gives me an 
> error saying that there are values not included, which of course I 
> know but I wish to ignore them.
>
> It seems that I am missing something quite simple.
>
> Any help would be appreciated.
>
> Regards
> Steve
>
> ______________________________________________
> 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.
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php



More information about the R-help mailing list