Hi Roslina,
x<-runif(1000,min=0, max=600)
hist(x)
x2<-ifelse(x<=300,x,300)
summary(x2)
hist(x2, ,breaks = c(0,50,100,150,200,250,300))
good luck
milton
On Mon, Sep 7, 2009 at 12:51 AM, Roslina Zakaria <zroslina@yahoo.com>
wrote:
> Hi r-users,
>
> I would like to know how to put all the data that is greater than certain
> value in certain cell for my histogram. For example, since maximum value
of
> p1 is 588 it doesn't fit in the breaks that we specified. Can we write
> breaks >300?
>
> max(p1[,2])
> pre.hist <- hist(p1[,2],breaks =
c(0,50,100,150,200,250,300),right=FALSE)
>
> > max(p1)
> [1] 587.2761
> > pre.hist <- hist(p1[,2],breaks =
c(0,50,100,150,200,250,300),right=FALSE)
> Error in hist.default(p1[, 2], breaks = c(0, 50, 100, 150, 200, 250, 300),
> :
> some 'x' not counted; maybe 'breaks' do not span range of
'x'
> > max(p1[,2])
> [1] 587.2761
>
> Thank you.
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>
[[alternative HTML version deleted]]