This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
# "faithful" is a dataset about a geyser, showing size of eruption vs. waiting | |
# time before the eruption | |
data <- as_tibble(datasets::faithful) %>% | |
mutate(index = 1:n()) %>% | |
head(10) | |
data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sigfig <- function(x, n = 2) { | |
formatC(signif(x, digits = n), digits = n, format = "fg", flag = "#") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Say I have some short-hand labels like "Ec/q", | |
# which actually stand for "E. coli & quinolones", | |
# but I want "E. coli" to be in italics | |
library(tidyverse) | |
n <- 100 | |
tibble( | |
x = rnorm(n), |
NewerOlder