[R] breaks in hist()

2005-11-02 Thread Leaf Sun
Dear listers,

A quick question about breaks in hist().

The histogram is highly screwed to the right, say, the range of the vector is 
[0, 2], but 95% of the value is squeezed in the interval (0.01, 0.2). My 
question is : how to set the breaks then make the histogram look even?

Thanks in advance,

Leaf

__
R-help@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

Re: [R] breaks in hist()

2005-11-02 Thread Francisco J. Zagmutt
Hi Leaf

The word even can be interpreted in several ways but I will give it a 
shot.
If you want to specify the breakpoints to represent the aggregation in your 
data you can use the argument breaks within histogram i.e.

x=c(runif(95,0,0.2),runif(5,.21,2))
hist(x, breaks=seq(0,2,.1), freq=F )#It will use breakpoints at 
0,0.1,0.2,...2

or you can also suggest a pre-defined number of cells i.e.
hist(x, breaks=7, freq=F )


You can also add a density line over the histogram using lines
lines(density(x, bw=.1))

Alternativelly, you can use some more basic visualization like a 
stem-and-leaf plot
stem(x)

I hope this helps

Francisco


From: Leaf Sun [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch r-help@stat.math.ethz.ch
Subject: [R] breaks in hist()
Date: Wed, 2 Nov 2005 10:48:45 -0700

Dear listers,

A quick question about breaks in hist().

The histogram is highly screwed to the right, say, the range of the vector 
is [0, 2], but 95% of the value is squeezed in the interval (0.01, 0.2). My 
question is : how to set the breaks then make the histogram look even?

Thanks in advance,

Leaf



__
R-help@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

__
R-help@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