View install_brms.R
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
# I don't understand why or how this | |
# plus what's in Makevars works, but it's | |
# the only way I can get rstan & brms installed\ | |
# see also: https://github.com/stan-dev/rstan/issues/1070#issuecomment-1570565599 | |
# renv::init(bare = TRUE) | |
Sys.setenv(MAKEFLAGS = "-j4") # four cores used | |
install.packages(c("Rcpp", "RcppEigen", "RcppParallel", "StanHeaders"), type = "source") | |
install.packages("rstan", type = "source") |
View mkproj.sh
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
#!/bin/sh | |
x="Version: 1.0 | |
RestoreWorkspace: Default | |
SaveWorkspace: Default | |
AlwaysSaveHistory: Default | |
EnableCodeIndexing: Yes | |
UseSpacesForTab: Yes | |
NumSpacesForTab: 2 | |
Encoding: UTF-8 |
View align_chunks.py
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
import pandas as pd | |
def align_chunks(X_df, Y_df, A_idx_list, B_idx_list, state, **kwargs): | |
""" | |
Given X_df and Y_df, return the dataframes (A_df and B_df) with the | |
smallest possible span of overlapping transcription chunks. | |
Function operates recursively. | |
""" |
View exitpoll.Rmd
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
--- | |
title: "R Notebook" | |
output: html_notebook | |
--- | |
Source: | |
https://edition.cnn.com/election/2016/results/exit-polls | |
```{r} |
View header.Rmd
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
--- | |
title: "Building up and evaluating models" | |
output: | |
html_notebook: | |
code_folding: none | |
css: ../custom.css | |
theme: flatly | |
toc: yes | |
toc_depth: 3 | |
toc_float: yes |
View header.Rmd
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
--- | |
title: "Building up and evaluating models" | |
output: | |
html_notebook: | |
code_folding: none | |
css: ../custom.css | |
theme: flatly | |
toc: yes | |
toc_depth: 3 | |
toc_float: yes |
View sigma_tween.R
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(tweenr) | |
library(gganimate) | |
library(ggplot2) | |
library(tidyverse) | |
#' define the 4 states | |
state1 <- data_frame(mean = 0, | |
sd = 1) | |
state2 <- data_frame(mean = 0, | |
sd = 3) |
View purrr_bootstrap.R
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(tidyverse) | |
replicates <- (1:100000)%>% | |
map(~sample(faithful$waiting, replace = T))%>% | |
map(mean)%>% | |
simplify() | |
data_frame(replicates = replicates)%>% | |
ggplot(aes(replicates))+ | |
stat_density() |
View purrr_bootstrap.R
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(tidyverse) | |
replicates <- (1:100000)%>% | |
map(~sample(faithful$waiting, replace = T))%>% | |
map(mean)%>% | |
simplify() | |
data_frame(replicates = replicates)%>% | |
ggplot(aes(replicates))+ | |
stat_density() |
View many_files_recipe.R
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
#' I often have individual speaker data files in a nested directory structure. | |
#' But I also often want to read all speaker's data into R in one big data frame. | |
#' Here's my current best recipe. | |
library(tidyverse) | |
#' glob for the file list. This is dependent on good directory naming practices | |
all_files <- Sys.glob("path/speakerid*/*.csv") | |
df <- data_frame(file = all_files) %>% # make a column of all of the file paths |
NewerOlder