Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205491

How can I add a error bar in dataframe and in ggplot2?

$
0
0

I am making a grouped bar graph using ggplot2. However, I am having trouble adding sd/sem. The standard errors are: '1,2,3,1'. How can I add Error Bar to this bar graph?

survey <- data.frame(group=rep(c("LG", "RM"),each=2),
                sample=rep(c("sample1", "sample2"),1),
                values=c(200,50,300,25 ))


library(ggplot2)
ggplot(survey, aes(x=sample, y=values, fill=group)) + 
 geom_bar(stat="identity", position=position_dodge())

Viewing all articles
Browse latest Browse all 205491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>