Skip to content

Instantly share code, notes, and snippets.

View zenrabbit's full-sized avatar
🎯
Focusing

zenrabbit zenrabbit

🎯
Focusing
View GitHub Profile
@zenrabbit
zenrabbit / reprex_CV
Created October 30, 2019 20:52
R Markdown for reproducible CV you can use to update from ORCID
---
title: ""
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
### CV
@zenrabbit
zenrabbit / better_kable
Created October 30, 2019 20:47
R Markdown code to wrap table from page to page in knit PDF & fit width using column_spec
#library(tidyverse)
#library(kable)
#library(kableExtra)
## read in table entitled table here
#table <- read_csv(./data/table) # etc.
knitr::kable(table, "latex", booktabs = TRUE, longtable = TRUE) %>%
column_spec(2, width = "8cm") %>%
column_spec(3, width = "4cm") %>%
@zenrabbit
zenrabbit / rmd_YAML_PDF.txt
Last active October 30, 2019 20:33
R Markdown YAML for knit to PDF with table of content without word contents
---
title: ""
author: you
header-includes:
\renewcommand{\contentsname}{}
output:
pdf_document:
fig_caption: no
toc: TRUE
toc_depth: 3
@zenrabbit
zenrabbit / studentID_converter_ID
Created October 26, 2019 22:40
Student ID simplifier to last 5 digits using R
grades <- grades %>%
mutate(ID = str_sub(student.ID, start = -5)) %>%
select(ID, everything()) %>%
na.exclude(.) #dplyr dependency
@zenrabbit
zenrabbit / YorkU Science grade letter assignments
Last active October 26, 2019 22:43
YorkU Science grade letter assignments
marks <- marks %>%
mutate(grade =
ifelse(percent < 45, "F",
ifelse(percent < 50, "E",
ifelse(percent < 55, "D",
ifelse(percent < 60, "D+",
ifelse(percent < 65, "C",
ifelse(percent < 70, "C+",
ifelse(percent < 75, "B",
ifelse(percent < 80, "B+",
@zenrabbit
zenrabbit / 001-k-samples-cv-test.R
Created March 4, 2018 00:04 — forked from benmarwick/001-k-samples-cv-test.R
Feltz and Miller (1996) asymptotic test for the equality of coefficients of variation from k populations
library(tidyverse)
# make example data
# summary stats from Feltz and Miller 1996
# http://onlinelibrary.wiley.com.sci-hub.cc/doi/10.1002/(SICI)1097-0258(19960330)15:6%3C647::AID-SIM184%3E3.0.CO;2-P/epdf
# (originally http://www.tandfonline.com.sci-hub.cc/doi/abs/10.1080/15321819308019845?journalCode=ljii19
miller <- data_frame(test = c('ELISA', 'WEHI', '`Viral inhibition`'),
Mean = c(6.8, 8.5, 6.0),