email = 'aaron.matthew.rosenberg@gmail.com'
This file contains 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
purrr::map_df(list.files("data"), read_csv) |
This file contains 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
# restore_packages.R | |
# | |
# installs each package from the stored list of packages | |
# source: http://hlplab.wordpress.com/2012/06/01/transferring-installed-packages-between-different-installations-of-r/ | |
load("~/installed_packages.rda") | |
for (count in 1:length(installedpackages)) { | |
install.packages(installedpackages[count]) | |
} |
This file contains 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
mtcars %>% | |
select_("mpg", "cyl", "disp", "hp") %>% | |
gather_("variable", "val", colnames(.)[!colnames(.) %in% c("hp")]) |
This file contains 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
sample_n_groups = function(tbl, size, replace = FALSE, weight = NULL) { | |
# regroup when done | |
grps = tbl %>% groups %>% lapply(as.character) %>% unlist | |
# check length of groups non-zero | |
keep = tbl %>% summarise() %>% ungroup() %>% sample_n(size, replace, weight) | |
# keep only selected groups, regroup because joins change count. | |
# regrouping may be unnecessary but joins do something funky to grouping variable | |
tbl %>% right_join(keep, by=grps) %>% group_by_(.dots = grps) | |
} |
This file contains 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
t_tester <- function(dv, fac, df) { | |
# takes raw (unquoted) names for dv (dependent variable) and fac (factor) as well as the data.frame | |
# returns the t-test statistic, p-value, and effect size (Cohen's D) | |
dv_q <- as.character(substitute(dv)) | |
fac_q <- as.character(substitute(fac)) | |
dv_enquo <- enquo(dv) | |
fac_enquo <- enquo(fac) | |
This file contains 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(magrittr) | |
library(lme4) | |
lmer(challenge ~ (1|program_ID) + (1|participant_ID) + (1|beep_ID_new), data = df) %>% | |
ranef() %>% | |
extract2("participant_ID") %>% | |
rownames_to_column(var = "participant_ID") %>% | |
rename() |
This file contains 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(dplyr) | |
library(rlang) | |
library(broom) | |
calculate_pooled_sd <- function(sd_group1, n_group1, sd_group2, n_group2) { | |
sqrt(((n_group1 - 1) * (sd_group1 ^ 2) + (n_group2 - 1) * (sd_group2 ^ 2)) / (n_group1 + n_group2 - 2)) | |
} | |
lmer_effect <- function(df, dv, lmer_model_object, var_name) { |
I hereby claim:
- I am jrosen48 on github.
- I am jrosenberg6432 (https://keybase.io/jrosenberg6432) on keybase.
- I have a public key ASAMOxD7F3KpqBeUNQY7jxfMeCERRyOuzMZv1te11rE-jgo
To claim this, I am signing this object:
This file contains 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(httr) | |
library(rjson) | |
# Go to https://developer.nest.com/clients to register a new Nest client | |
# Nest OAuth 2.0 endpoints | |
nest <- oauth_endpoint( | |
request=NULL, | |
authorize="https://home.nest.com/login/oauth2?state=login", | |
access="https://api.home.nest.com/oauth2/access_token" |
OlderNewer