Skip to content

Instantly share code, notes, and snippets.

View jkaupp's full-sized avatar

Jake Kaupp jkaupp

View GitHub Profile
@jkaupp
jkaupp / LOPUS.R
Created April 18, 2017 16:55
LOPUS Script
# The following code was written by Jake Kaupp at Queen's University, Kingston, Canada
# for looking at LOPUS observation data
# Date: February 2017
library(jsonlite)
library(plyr)
library(tidyverse)
library(lubridate)
# Data file is located in the same direoctory as this script
@jkaupp
jkaupp / passwd_prototype.R
Created January 19, 2016 01:53 — forked from ojessen/passwd_prototype.R
Protoype password handling with hash
require(digest)
require(shiny)
ui <- basicPage(
uiOutput("register"),
actionButton("doRegister",label="Register"),
verbatimTextOutput("resultRegister"),
uiOutput("login"),
library(proto)
stat_smooth_func <- function (mapping = NULL, data = NULL, geom = "smooth", position = "identity",
method = "auto", formula = y ~ x, se = TRUE, n = 80, fullrange = FALSE,
level = 0.95, na.rm = FALSE, ...) {
StatSmoothFunc$new(mapping = mapping, data = data, geom = geom, position = position,
method = method, formula = formula, se = se, n = n, fullrange = fullrange,
level = level, na.rm = na.rm, ...)
}
@jkaupp
jkaupp / mode.R
Created December 3, 2015 17:23
R function to calculate the mode of a dataset.
Mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
@jkaupp
jkaupp / README.md
Created April 14, 2015 17:26
Curriculum Dendrogram
stock <- "MSFT"
start.date <- "2012-01-01"
end.date <- Sys.Date()
quote <- paste("http://ichart.finance.yahoo.com/table.csv?s=",
stock,
"&a=", substr(start.date,6,7),
"&b=", substr(start.date, 9, 10),
"&c=", substr(start.date, 1,4),
"&d=", substr(end.date,6,7),
"&e=", substr(end.date, 9, 10),
# See also the entry on stackoverflow: http://goo.gl/KUvmW2
library(lattice)
library(chron)
source("http://blog.revolutionanalytics.com/downloads/calendarHeat.R")
# Plot as calendar heatmap
calendarHeat(stock.data$Date, stock.data$Adj.Close,
varname="MSFT Adjusted Close")
@jkaupp
jkaupp / gist:0b8a58e790b602d92833
Created February 9, 2015 14:53
#IVMOOC Assignment 3 Code
library(plyr)
library(gdata)
library(ggmap)
library(ggplot2)
setwd("/Users/Jake/Documents/MOOCs/IVMOOC")
data <- read.csv("NSF Master LandL.csv")
data.state <-ddply(data, .(state, Latitude, Longitude), summarize, expected_total_amount=sum(expected_total_amount))