[R] Histogram ploting

Christophe Pallier pallier at lscp.ehess.fr
Sun Apr 18 15:17:02 CEST 2004


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:
>
> Class    N
> 12.5    3
> 17.5    10
> 22.5    12
> 27.5    8
> 32.5    7
> 37.5    3
> 42.5    4
> 47.5    2
>
> 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
>




More information about the R-help mailing list