Re: [R] Histogram ploting

2004-04-19 Thread Martin Maechler
 Mateusz == Mateusz £oskot [EMAIL PROTECTED]
 on Sun, 18 Apr 2004 17:13:34 +0200 writes:

Mateusz Hi Christophe, On 4/18/2004 3:17 PM, Christophe
Mateusz Pallier wrote:
 The 'hist' function works on the raw data.  In your data
 set example, you have already computed the number of data
 points in each bin.

Mateusz Yes, you are right. I evidently misunderstood the
Mateusz hist function usage described in manuals.

 What you really want is probably a barplot of N You could
 display your data:
 
 plot(Class,N,'h')

Mateusz Yes, that's right.  Thank you very much.

well, I think you did have real histogram data,
and in teaching about graphics I do emphasize the difference
between a barplot {in R: plot of table(); space between bars} 
and a histogram {continuous x; no space between bars}.

In this case, I'd rather construct an object of class
'histogram' and plot() it, i.e., call the plot.histogram method:

(mids - seq(12.5, 47.5, by = 5))
N - c(3,10, 12,8, 7,3, 4,2)
## Construct breaks from  mids  in general
## (here, simply br - seq(10,50,by=5) is easier)
dx - mean(diff(mids))
br - (mids[-1] + mids[-length(mids)])/2
(br - c(br[1] - dx, br, br[length(br)] + dx))

his - list(breaks=br, counts=N, mids = mids)
class(his) - histogram
plot(his, main = Histogram of my stuff)


Regards,
Martin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Histogram ploting

2004-04-18 Thread Christophe Pallier
Hello Mateusz,

The 'hist' function works on the raw data.
In your data set example, you have already computed the number of data 
points in each bin.
What you really want is probably a barplot of N

You could display your data:

plot(Class,N,'h')

Or

names(N)-Class
barplot(N)
Christophe Pallier

oskot wrote:

Hi,

It's my first post on this group.
I've just started learning  using R and I like it ;-)
I have I think simple question. I'm trying to plot
a histogram for my data set.
My data set is defined as follows:
ClassN
12.53
17.510
22.512
27.58
32.57
37.53
42.54
47.52
Class means middle of set of my ranges I define.
N column stores number of measurements counted to
particular class.
And now I would like to plot a simple histogram presenting
numbers of measurements in each class.
As I read in manual, hist function takes x (my N) as the first param
but I can not identify how should I pass my
class ranged into hist function.
I believe you can understand my problem ;-)))
Could anyone help me ?
Kind regards

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Histogram ploting

2004-04-18 Thread Mateusz oskot
Hi Christophe,

On 4/18/2004 3:17 PM, Christophe Pallier wrote:
The 'hist' function works on the raw data.
In your data set example, you have already computed the number of data 
points in each bin.
Yes, you are right. I evidently misunderstood the hist function
usage described in manuals.
What you really want is probably a barplot of N
You could display your data:
plot(Class,N,'h')
Yes, that's right.
Thank you very much.
Kind regards

--

Mateusz oskot
mateusz at loskot dot net
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html