Skip to content

Instantly share code, notes, and snippets.

View djhocking's full-sized avatar

Daniel J. Hocking djhocking

View GitHub Profile
@djhocking
djhocking / predict_vs_simulate.org
Created April 21, 2016 19:21 — forked from tmalsburg/predict_vs_simulate.org
Predict vs simulate in lme4

Predict vs simulate in lme4

For this investigation we are going to use the sleepdata data set from the lme4 package. Here is the head of the data frame:

@djhocking
djhocking / subset_save.R
Last active November 9, 2018 04:01
Subset and Save
# make fake dataset
df <- data.frame(x = runif(100, 0, 1), y = rnorm(100, 10, 3), z = rpois(100, 10))
# subset dataframe
df_sub <- df[which(df$x >= 0.75), ]
# subset using dplyr
library(dplyr)
df_sub2 <- df %>%