> msleep2<-msleep%>%filter(!is.na(vore))
> ggplot(data=msleep2,aes(x=vore,y=sleep_total))+geom_boxplot()
<Add another representative's value>
> ggplot(data=msleep2,aes(x=vore,y=sleep_total))+geom_boxplot()+stat_summary(fun="mean",geom="point")
> ggplot(data=msleep2,aes(x=vore,y=sleep_total))+geom_boxplot()+stat_summary(fun="mean",geom="point",shape=22,fill="red")
> ggplot(data=msleep2,aes(x=vore,y=sleep_total))+geom_boxplot()+stat_summary(fun="median",geom="point",shape=21,fill="red",size=3)
> ggplot(data=msleep2,aes(x=vore,y=sleep_total,group=1))+geom_point()+stat_summary(fun="median",geom="line",colour="red")
> ggplot(data=msleep2,aes(x=vore,y=sleep_total))+geom_point()+stat_summary(fun="median",geom="point",shape=21,fill="red",size=3)
> ggplot(data=msleep2,aes(x=vore,y=sleep_total,group=1))+geom_point()+stat_summary(fun="mean",geom="point",fill="blue",size=3,shape=21)+stat_summary(fun="median",geom="line",colour="red")
> ggplot(data=msleep2,aes(x=vore,y=sleep_total))+geom_point()+stat_summary(fun="median",geom="crossbar",colour="red")
> msleep<-msleep%>%mutate(sleep_rem_d=sleep_rem-1.87541)
> msleep2<-msleep%>%mutate(rem_rank=ifelse(sleep_rem_d<=0,"little","much"))%>%group_by(vore,rem_rank)
> ggplot(data=msleep2,aes(x=vore,y=sleep_rem_d,fill=rem_rank))+geom_bar(stat="identity")
> ggplot(data=msleep2,aes(x=vore,y=sleep_rem_d,fill=rem_rank))+geom_bar(stat="identity")+stat_summary(fun=mean,geom="point")
> ggplot(data=msleep2,aes(x=vore,y=sleep_rem_d,fill=rem_rank))+geom_bar(stat="identity")+stat_summary(fun=mean,geom="crossbar")
> ggplot(data=msleep2,aes(x=vore,y=sleep_rem_d,fill=rem_rank,group=rem_rank))+geom_bar(stat="identity")+stat_summary(fun=mean,geom="line")
> ggplot(data=msleep2,aes(x=vore,y=sleep_rem_d,fill=rem_rank,group=rem_rank))+geom_bar(stat="identity")+stat_summary(fun=mean,geom="point")+stat_summary(fun=mean,fun.max=function(x)mean(x)+sd(x),fun.min=function(x)mean(x)-sd(x),geom="errorbar")
'R' 카테고리의 다른 글
(R) Normal approximation to Binomial (0) | 2020.09.27 |
---|---|
(R) geom_violin() - a density graph (0) | 2020.09.09 |
(R) The way to interpret boxplot in R (0) | 2020.09.07 |
(R) comparing several kernal density curves (0) | 2020.09.04 |
(R) Histogram to Scale Histogram / Scale Histogram and Density curve/binwidth/adjust of geom_density() (0) | 2020.09.04 |