Skip to content

Instantly share code, notes, and snippets.

View Myfanwy's full-sized avatar

Myfanwy Johnston Myfanwy

View GitHub Profile
@Myfanwy
Myfanwy / ggplot2 Resources
Last active August 29, 2015 14:16
ggplot2 Resources
http://zevross.com/blog/2014/08/04/beautiful-plotting-in-r-a-ggplot2-cheatsheet-3/
@Myfanwy
Myfanwy / Visual Tech Round-Up 2015
Last active August 29, 2015 14:16
Visual Tech Round-up 2015 - Topics Not Covered
http://stackoverflow.com/questions/2162131/how-can-i-learn-to-create-beautiful-infographics-with-connection-to-my-r-knowle
@Myfanwy
Myfanwy / MonkeyModel.R
Last active August 29, 2015 14:20
Kelly Finn's Monkey Data - McElreath's Model
library(rethinking) #requries rstan, inline, Rcpp
# Predict: y in [0,1]
# With: x
m_glm <- glm(y ~ x, data = your_data, family = binomial) #binomial dist assumes a logit link. This is essentially the same as Emilio's model, except Emilio included a green effect qualifier
# Mathematical form:
# y_i ~ bonimial( 1, p_i) ;
# logit(p_i) = a + b*x_i
library(SmarterPoland)
library(riverplot)
library(RColorBrewer)
library(graphics)
library(reshape2)
library(plyr)
library(stringr)
library(countrycode)
# DOWNLOAD THE DATA
@Myfanwy
Myfanwy / timestimestimes.R
Created November 24, 2015 22:15
All the ways I know to get things in the right date/time format
# All of my times are in mm/dd/yyyy hh:mm:ss
# From a character string (read in from read.csv(stringsAsFactors = FALSE))
# By far the easiest way is with lubridate::mdy_hms()
#Ex:
options(stringsAsFactors = FALSE)
Sys.timezone(location = FALSE)
Sys.setenv(TZ = "Pacific/Pitcairn")
@Myfanwy
Myfanwy / Presentation by Karen Ng July 20 2016
Last active July 20, 2016 21:32
Davis D3 Meetups: Karen Ng on Hosting D3 Visualizations on GitHub.
Karen's D3 Example:
http://karenyng.github.io/HW4_Stat250_W14/
It's from a template: http://square.github.io/crossfilter/ (you can fork the repo from the link on the page).
Part 1: How to host a visualization on github
For people to be able to see your visualization, you have to actually host it on a server somewhere. The free, easy way is on GitHub.
1. For any visualization you want to host, first create a github repository for it. This will be the master branch.
@Myfanwy
Myfanwy / mattlieberis
Created September 16, 2016 22:23
Matt Lieber Is
library(rvest)
library(dplyr)
library(stringr)
toMatch <- "Matt Lieber is"
# Try with first page
url <- "https://gimletmedia.com/show/reply-all/episodes/"
pgfull <- read_html(url)
texts <- pgfull %>%
@Myfanwy
Myfanwy / custom css for reveal.js slideshow in R
Last active August 20, 2023 16:58
Custom css for reveal.js slideshow
/**
* A simple theme for myfanwy.github.io
*
* reveal.js is Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
<link href='http://fonts.googleapis.com/css?family=Megrim' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Raleway:300,400,700' rel='stylesheet' type='text/css'>
/*********************************************
@Myfanwy
Myfanwy / jekyll-google-calendar
Last active October 6, 2016 17:59 — forked from iani/jekyll-google-calendar
Embed google calendar in a web page for rendering by Jekyll. Copied from: https://github.com/StevenBlack/qst-jekyll-bootstrap/blob/master/calendar.html see it in action here: http://www.queenssailing.ca/calendar/
---
layout: page
title: Davis R-Users Group Calendar
permalink: /calendar/
type: info
header_text: Davis R-Users Group Calendar
calendar: true
---
<div class="span3">
<h3>Davis R-Users Group Events</h3>
library(tidyverse)
tt <- structure(list(TagID = c(2051L, 2051L, 2052L, 2055L, 2055L, 2057L,
2057L, 2058L, 2058L, 2059L, 2059L, 2061L, 2062L, 2063L, 2063L,
2064L, 2064L, 2066L, 2066L, 2067L, 2067L, 2068L, 2069L, 2070L,
2070L, 2071L, 2072L, 2073L, 2074L, 2075L, 2075L, 2076L, 2076L,
2077L, 2117L, 2117L), ttime = structure(c(17.0865856481481, 17.0865856481481,
5.9287037037037, 14.2212037037037, 14.2212037037037, 5.84836805555556,
5.84836805555556, 14.3217361111111, 14.3217361111111, 11.6971759259259,