[R] Histogram

Ritwik Sinha ritwik.sinha at gmail.com
Thu Sep 28 01:47:46 CEST 2006


Hi,

There may be an easier way but here is one way you can do it.

# create vector that has Y[i] X[i]s
new.data <- rep(X,Y)

hist(new.data, breaks=c(0,.1,.4,.6)) # or something like that look at
what exactly breaks should be.

Ritwik.

On 9/27/06, Mohsen Jafarikia <jafarikia at gmail.com> wrote:
> Dear all,
>
> I want to design a histogram and I need to have the frequency at certain
> points. For example I have the following 2 columns:
>
> *X      Y*
>
> 0.1    25
> 0.4    22
> 0.45  11
> 0.55  21
>
> I want the chart to have 4 columns. First column is from 0.0-0.1 (on X) and
> frequency is 25. Next colum is wider and form 0.1-0.4 with 22 frequency.
> Next column is narrow with 11 frequency and the last column is the same as
> the first one with 21 frequency.
>
> Can anybody tell me how I can have this chart.
>
> Thanks,
> Mohsen
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University
ritwik.sinha at gmail.com | +12163682366 | http://darwin.cwru.edu/~rsinha



More information about the R-help mailing list