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
%% ASR Formatted Bibliography using BibTeX | |
%% requires the American Sociological Review .bst file - http://people.ku.edu/~chkim/etc/asr.bst | |
%% requires a properly formatted .bib file | |
%% requires that the key inserted below matches a key in that .bib file | |
\documentclass{book} | |
\usepackage{chicago} | |
\begin{document} |
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
# batch edit column names based on a particular phrase | |
# store data in global environment, modify | |
mpg <- ggplot2::mpg | |
colnames(mpg) <- paste("depression", colnames(mpg), sep = "_") | |
# as a function | |
rename_by_phrase <- function(.data, pattern, replacement){ | |
# modify variable names based on input |
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
# find where to locate Anchorage, AK using the albersusa package | |
# dependencies | |
library(albersusa) # composite projection | |
library(dplyr) # data wrangling | |
library(ggplot2) # mapping | |
library(mapview) # preview | |
library(sf) # spatial data | |
# load composite map |
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
// ========================================================================== | |
// Minimal Working Example - Independent Sample T-Test Plot | |
// ========================================================================== | |
// standard opening options | |
version 14 | |
log close _all |
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
// ========================================================================== | |
// Minimal Working Example - One Sample T-Test Plot | |
// ========================================================================== | |
// standard opening options | |
version 14 | |
log close _all |
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
# Bivariate Choropleth Map | |
## this is based on Timo Grossenbacher and Angelo Zehr's tutorial - | |
## https://timogrossenbacher.ch/2019/04/bivariate-maps-with-ggplot2-and-sf/ | |
# dependencies | |
library(dplyr) # data wrangling | |
library(ggplot2) # plotting | |
library(purrr) # iteration | |
library(tidyr) # data wrangling |
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: "SOC 1120-01" | |
subtitle: "Fall 2019 Attendance" | |
author: "Christopher Prener, Ph.D." | |
institute: "Saint Louis University" | |
date: "2019/08/19 (updated: `r Sys.Date()`)" | |
output: | |
xaringan::moon_reader: | |
lib_dir: libs | |
nature: |
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
# dependencies | |
library(dplyr) | |
library(googledrive) | |
library(lubridate) | |
library(readr) | |
library(stringr) | |
# download form data | |
forms <- drive_find(pattern = "FA19-01") |
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
# Parse Census Bureau address range data | |
# Problem: | |
# We need a way to match incidents (that have address-level data) to the blockface they occur on. | |
# By blockface, I mean the houses on either side of a street between two cross streets (i.e. | |
# the 100-block of Main Street between 1st and 2nd Avenues). | |
# | |
# Typically, census block and city block shapefiles do not represent a blockface. Instead, | |
# they have parts of up to four different streets, typically representing half of a blockface | |
# for each of the included streets. So a block bounded by Main Street on the south, 1st Avenue |
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
# These two functions address a common problem in my work - files named "monthYYYY.CSV.html" - | |
# e.g. "August2018.CSV.html". The prep_dir() function creates a vector of filenames in a given directory | |
# and then iterates over each using purrr::map(). The map() function calls our second function, edit_filename(). | |
# For each time it is called, edit_filename() uses the magic of stringr and fs (okay, it isn't really magic) | |
# to rename the file appropriately. | |
# dependencies: | |
# install.packages(c("fs", "magrittr", "purrr", "stringr")) | |
# include in script: |
NewerOlder