Skip to content

Instantly share code, notes, and snippets.

@rbcavanaugh
rbcavanaugh / gist:b396eb68b5fce49b51e98b9939d90853
Created September 15, 2025 15:40
Reproducible model tables using flextable
library(dplyr)
library(flextable)
library(officer)
library(parameters)
library(easystats)
# theming for apa
theme_apa2 <- function(.data, pad = 0, spacing = 2) {
apa.border <- list("width" = 1, color = "black", style = "solid")
@rbcavanaugh
rbcavanaugh / QAB Macro Parser
Last active September 2, 2024 19:32
Parse the Excel Macro File for the Quick Aphasia Battery in R with minimal dependencies
# install.packages("readxl")
library(readxl)
clean_qab_macro <- function(path){
macro <- suppressMessages(readxl::read_excel(path))
if(all(!is.na(macro[11:18,2][,1]))){
level_of_consciousness_1 <- data.frame(
question = macro[11:18,1][[1]],
@rbcavanaugh
rbcavanaugh / allofus_package_data.R
Created December 7, 2023 15:17
creating the aou_codebook and aou_health_history data files
library(shiny)
library(googlesheets4)
library(tidyverse)
library(ohdsilab)
library(keyring)
library(DatabaseConnector)
library(fuzzyjoin)
gs4_deauth()
@rbcavanaugh
rbcavanaugh / sample_data.R
Created June 22, 2023 14:22
sample data for anticlust
data = tibble::tribble(
~word, ~in_discourse, ~discourse_stimuli, ~agreement, ~item_difficulty, ~core_lex_percent,
"nose", 1, "wanderer", 88, -1.34858, 46.875,
"fly", 0, NA, 99, -1.32686, NA,
"book", 1, "arrival_2", 90, -1.26116, 59.375,
"toe", 0, NA, 95, -1.22168, NA,
"chair", 1, "return", 88, -1.19882, 46.875,
"pie", 1, "dinosaurs_spacemen_and_ghouls", 73, -1.19258, 34.375,
"bear", 1, "escape_from_the_zoo", 100, -1.16156, 78.125,
"shirt", 1, "fl
@rbcavanaugh
rbcavanaugh / academic_cv.css
Created February 23, 2022 03:15
Pagedown academic CV
/* beginning of altered resume css*/
@page{
size: letter portrait;
margin: 1in 0.5in 1in 0.25in;
}
*{
box-sizing: border-box;
}
Sub insertImages()
Dim strTemp As String
Dim strPath As String
Dim strFileSpec As String
Dim oSld As Slide
Dim oPic As Shape
' Edit these to suit:
strPath = "C:\Users\12074\Desktop\cows\"
strFileSpec = "*.jpg"
strTemp = Dir(strPath & strFileSpec)