knitr::opts_chunk$set(echo = TRUE)

Resources

From Data to Viz, Yan Holtz

Pimp my RMD: a few tips for R Markdown, Yan Holtz

Themes to Improve Your ggplot Figures, R for the Rest of Us blog, David Keyes

How to Make Beautiful Tables in R, R for the Rest of Us blog, David Keyes

rstudio4edu: A Handbook for Teaching and Learning with R and RStudio, Desirée De Leon & Alison Hill

Teacups, Giraffes, and Statistics, Hasse Wallum & Desirée de Leon

R Markdown Websites, R Markdown

R Markdown Reference Guide, R Markdown

Bootswatch themes, Bootswatch

Tables

For publication

library(flextable)

For data viewing

library(DT)
datatable(mtcars, rownames = FALSE, filter="top", options = list(pageLength = 5, scrollX=T) )

Figure aesthetics

##########################################
##### SOURCE CODE: Figure aesthetics #####
##########################################

# Code for figure aesthetics:
# Creating color palette/label vectors
# Setting the ggplot theme

# Packages
library(ggplot2)
library(dplyr)
library(calecopal)

### THINGS TO ADD: sessionInfo(), package for package version info?


##### Color palette vectors #####

# Color palette for PURPOSE
v_cols <- c('#COLOR', '#COLOR', '#COLOR')
names(v_cols) <- c('VARIABLE', 'VARIABLE', 'VARIABLE')



##### Label vectors #####

# Labels for PURPOSE
v_labs <- c('LABEL', 'LABEL', 'LABEL')
names(v_labs) <- c('VARIABLE', 'VARIABLE', 'VARIABLE')



##### ggplot themes #####

# `theme_set` replaces the default
# `theme_update` adds new elements to the default theme (analogous to `+`)
# `theme_replace` replaces elements of the default theme


# Scatter plot
theme_scatter <- theme_classic()
theme_set(theme_scatter)
theme_update()


ggplot(cars, aes(x = speed, y = dist)) + geom_point()


katekathrynkat/katereR documentation built on Dec. 21, 2021, 5:19 a.m.