Code Snippets

These are the code snippets I rarely use, so, I keep forgetting them. This is a central resource for these.

R

  • To supress package start up messages in RMD.
    suppressPackageStartupMessages(
    {library(THE_PACKAGE_NAME)
     library(THE_PACKAGE2_NAME)})
    
  • geom_ribbon for plotting Confidence Intervals
    ggplot(df, aes(x=x, y=y)) + geom_line(aes(color=grp)) +
    geom_ribbon(aes(ymin=y-(1.96*se), ymax=y+(1.96*se), group=grp), alpha=0.2,  fill="grey70")