I'm trying to create a stacked bar chart displaying percentages of values presented in two columns of a dataframe.
I have two problems with the stacked bar chart my code generates, that I think are linked.

ggplot2will not let me display %, but shows the input values as a share of 1.0. I cannot fix it withscale_y_continuous(labels = percent_format())which I found when looking around here at SO, so I am at loss on how to solve this?My error bars are extremely long. Perhaps this is because the SEM is counted on percent but my graph is presenting share out of 1.0. So all values are 1/100 of what they are in my data frame?
My dataframe:
ID Group Labeled Unlabeled
A 0 2 98
B 0 2 98
C 0 4 96
D 0 4 96
E 0 4 96
A 1 50 50
B 1 40 60
C 1 50 50
D 1 40 60
E 1 30 70
A 2 30 70
B 2 30 70
C 2 20 80
D 2 20 80
E 2 20 80
A 3 10 90
B 3 10 90
C 3 5 95
D 3 10 90
E 3 5 95
A 4 2 98
B 4 2 98
C 4 1 99
D 4 1 99
E 4 0 100
My code:
library(ggplot2)
library(plyr)
library(reshape2)
#Calculate means for both groups
melted <- melt(data, id.vars=c("ID", "Group"))
means <- ddply(melted, c("variable", "Group"), summarise,
mean=mean(value))
#Draw bar plot with ggplot2
plot <- ggplot(data=means, aes(x=Group, y=mean, fill=variable)) +
geom_bar(stat="identity",
position="fill",
width = 0.4) +
xlab(" ") + ylab("Percentage (%)") +
theme_classic(base_size = 16, base_family = "Helvetica") +
theme(axis.text.y=element_text(size=16, face="bold")) +
theme(axis.title.y=element_text(size=16, face="bold", vjust=1)) +
theme(axis.text.x=element_text(angle=45,hjust=1,vjust=1, size=16, face="bold")) +
theme(legend.position="right")
# Calc SEM
means.sem <- ddply(melted, c("variable", "Group"), summarise,
mean=mean(value), sem=sd(value)/sqrt(length(value)))
means.sem <- transform(means.sem, lower=mean-sem, upper=mean+sem)
# Add SEM & change appearance of barplot
plotSEM <- plot + geom_errorbar(data=means.sem, aes(ymax=upper, ymin=lower), position="fill", width=0.15)

