[R] ggplot/ barplot
smartpink111 at yahoo.com
Fri Feb 28 07:37:25 CET 2014
YOu can try:
DataA$percent <- with(DataA,round((Var2/sum(Var2))*100,2))
On Thursday, February 27, 2014 5:02 PM, farnoosh sheikhi <farnoosh_81 at yahoo.com> wrote:
I hope all is well.
I have a data set like below. I want to get a barplot by ggplot function in R that can change the color of the bins and also shows the percentage of each category on the bin too.
Percentage can be calculated as follow: (DataA$Var2/sum(DataA$Var2))*100
DataA <- read.table(text="ID,Var1,Var2
Thank you so much for your help and time.
Regards, Farnoosh Sheikhi
More information about the R-help