R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

datf<- datf[datf$Parameter%in%c("Residual_var",  "Add_genVar","Phenvar"),]
datf$Parameter<- as.factor(datf$Parameter)

## 
datf$Parameter <- ordered(datf$Parameter, levels = c("Residual_var",  "Add_genVar","Phenvar"))
datf$Trait <- ordered(datf$Trait, levels = c("wt_2top", "wt_2sw", "wt_3sw", "wt_4sw","wt_5sw"))

maxval=datf$Var  + datf$SE
minval=datf$Var  - datf$SE
limits=aes(ymax = maxval, ymin=minval)

p1=ggplot(datf, aes(x = Trait, y = Var, fill = Parameter)) +
  geom_col(alpha = 0.5, position = 'dodge') +
  geom_errorbar(aes(ymin = minval, ymax = maxval),
                width = 0.2,  
                position = position_dodge(.9)) +
  theme_bw()+  scale_fill_manual(values = c("skyblue","cyan","brown"))+ggtitle(" Additive, residual and phenotypic variance for wt2top , wt2sw, wt3sw, wt4sw and wtsw5")
p1

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.