Skip to content

Instantly share code, notes, and snippets.

View jenniferthompson's full-sized avatar

Jennifer Thompson jenniferthompson

View GitHub Profile
@jenniferthompson
jenniferthompson / genericized_dd.Rmd
Last active November 11, 2023 23:56
Example structure for data dictionary + code used for derivation using RMarkdown. Creates three data tables and documents general + field-specific info.
---
title: "Example Data Dictionary"
author: "Jennifer Thompson"
date: "11/1/2018"
output:
html_document:
theme: yeti
code_folding: hide
---
@jenniferthompson
jenniferthompson / msuexample.R
Last active April 10, 2021 19:18
Try example code from `multistateutils` Example vignette
## Work through examples in multistateutils docs
library(mstate)
library(flexsurv)
library(multistateutils)
data(ebmt3)
tmat <- trans.illdeath(c('transplant', 'pr', 'rfs'))
tmat
library(ggplot2)
ggplot(
data = subset(
diamonds, cut %in% c("Fair", "Good") &
color %in% LETTERS[4:5]
),
aes(x = carat, y = price)
) +
facet_wrap(~ cut + color, nrow = 1) +
@jenniferthompson
jenniferthompson / cruisemath.R
Created June 28, 2018 20:06
One time I went on a cruise with eight other people, and we got a refund, and we had to figure out how to split it under multiple scenarios. It was complicated.
jmj.org <- 3975.77
ja.org <- 3250
gf.org <- 4139.18
gf.refund <- 2874.00
jmj.refund <- 2694.75
total.org <- jmj.org + ja.org + gf.org
total.refund <- gf.refund + jmj.refund
@jenniferthompson
jenniferthompson / boxridge.R
Last active March 26, 2021 19:07
Combine boxplots + ridgeplots using patchwork
################################################################################
## Example code for generating side-by-side boxplots + raw data and ridgeplots
## NOTE: Uses Thomas Lin Pedersen's patchwork package, not yet on CRAN @ writing
################################################################################
## devtools::install_github("thomasp85/patchwork")
library(patchwork)
library(ggridges)
library(tidyverse)
## for data generation & management; could do this with base, of course, but I
@jenniferthompson
jenniferthompson / survminer_test.Rmd
Created February 15, 2018 15:53
Trying to figure out causes for blank spaces when using the survminer package
---
title: "Testing survminer blank spaces"
output: html_notebook
---
I'm getting a huge blank space when printing results from `ggsurvminer()`, as noted in [this StackOverflow post](https://stackoverflow.com/questions/42479112/survival-plots-with-survminer-blank-plot). Let's see if it does the same in a fresh session/other OS.
```{r}
library(survival)
library(survminer)
@jenniferthompson
jenniferthompson / brunch.R
Created February 13, 2018 22:39
R script to summarize my grocery list for New Years Brunch 2018
## Doesn't include: salt, pepper, oil, vanilla, honey, baking soda, nutmeg, Dijon mustard, red wine vinegar, spices I know I have
library(tidyverse)
## How many batches of chocolate babka muffins? I originally started with 2 but
## more people RSVPed...
babka_batches <- 3
brunch_list <- tribble(
~ Dish, ~ Homemade, ~ Time, ~ Ingredients,

Keybase proof

I hereby claim:

To claim this, I am signing this object: