Re: some help to improve "hist to plot relative frequencies"
On Fri, Jun 15, 2012 at 9:22 PM, gianni lavaredo
<[hidden email]> wrote:
> Dear Researches,
> sorry for disturb. I wish to improve my figure in R plotting the relative
> frequencies of my data set.
> a <- c(0,0,0,1,1,2,4,5,6,7,7,7,7,7,8,8,8,8,9,9,9,9,10,10,11)
> histogram(a, xlab="myData")
> what i wish to do is:
> 1) invert the order of X and Y (eg: Precent of Total on X-axis and "MyData"
> on X-axis)
> 2) plot not the bar of histogram but a line (i tried with
> "lines(density(a))" but the result is not what i wish)
Take your pick:
ta <- table(a)
dotplot(ta, type = "h", lwd = 2, origin = 0)
dotplot(100 * prop.table(ta), type = "h", lwd = 2, origin = 0,
xlab = "Percent of total")