Skip to content

Instantly share code, notes, and snippets.

View rccordell's full-sized avatar

Ryan Cordell rccordell

View GitHub Profile
@rccordell
rccordell / bibleFindAndReplace.R
Last active June 7, 2019 03:25
This find & replace function was inspired by Daniel Mallory Ortberg's "Bible Verses Where 'Behold' Has Been Replaced With Look, Buddy” <http://the-toast.net/2016/06/06/bible-verses-where-behold-has-been-replaced-with-look-buddy/>, allowing you to create a dataframe of verses from the Bible with similar substitutions.
# imports the necessary libraries
library(scriptuRs, stringr)
# creates a function to import Bible data, select important columns, detect the first string passed to the function, and create a new column in which that string is replaced by the second string passed to the function. Function returns a dataframe of each verse that includes the first string. The `revText` column contains the revised text of each verse.
bibleEdit <- function(kjv, nkjv){
bible <- kjv_bible() %>%
select(chapter_number, verse_number, verse_title, book_title, text) %>%
drop_na(text) %>%
filter(grepl(kjv, text, ignore.case = T)) %>%
# filter(str_detect(text, kjv)) %>%
@rccordell
rccordell / renderSite.R
Last active September 8, 2020 00:42
This script builds on Aleszu Bajak's excellent [tutorial on building a course website using R Markdown and Github pages](http://www.storybench.org/convert-google-doc-rmarkdown-publish-github-pages/). It automates the rendering of HTML files from RMD and automatically generates the page menu for the site, eliminating much duplicative work.
# This script builds on Aleszu Bajak's excellent
# [tutorial on building a course website using R Markdown and Github pages](http://www.storybench.org/convert-google-doc-rmarkdown-publish-github-pages/).
# I was excited about the concept but wanted to automate a few of the production steps: namely generating the HTML files
# for the site from the RMD pages (which Aleszu describes doing one-by-one) and generating the site navigation menu,
# which Aleszu handcodes in the `_site.yml` file. This script should automate both processes, though it may have some quirks
# unique to my setup that you'd want to tweak to fit your own. It's likely more loquacious than necessary as well, so feel free
# to condense as you can. Ideally, each time you make updates to your RMD files you can run this script to generate updated HTML
# pages and a new `_site.yml`. Then commit changes to Github and you're up and running!
# Once you've got everything configured for your own site below, you should be able to run `source('rend
@rccordell
rccordell / PoetryBot.rmd
Last active February 5, 2019 01:50 — forked from bmschmidt/words.R
---
title: "Programming Literary Bots"
author: "Ryan Cordell"
date: "3/12/2017"
output: html_document
---
## Acknowledgements
This version of my twitterbot assignment was adapted from [an original written in Python](https://www.dropbox.com/s/r1py3zazde2turk/Trendingmore.py?dl=0), which itself adapted code written by Mark Sample. That orginal bot tweeted (I've since stopped it) at [Quoth the Ravbot](https://twitter.com/Quoth__the). The current version owes much to advice and code borrowed from two colleagues at Northeastern University: Jonathan Fitzgerald and Benjamin Schmidt.