Skip to content

Instantly share code, notes, and snippets.

View walkerjeffd's full-sized avatar

Jeff Walker walkerjeffd

View GitHub Profile
@walkerjeffd
walkerjeffd / README.md
Created May 22, 2016 19:32
Force Simulation Between Targets
@walkerjeffd
walkerjeffd / .block
Last active May 6, 2016 19:14
Multi-Foci Force Layout Along A Curved Path
license: gpl-3.0
@walkerjeffd
walkerjeffd / .block
Last active May 4, 2016 20:58
Multi-Foci Force Layout Along Path
license: gpl-3.0
license: gpl-3.0
height: 200
@walkerjeffd
walkerjeffd / README.md
Created January 22, 2016 21:00
transition test 2
@walkerjeffd
walkerjeffd / README.md
Created January 22, 2016 20:55
transition test
@walkerjeffd
walkerjeffd / is_regular.R
Created August 7, 2013 23:04
R function to test is vector of datetimes is regular and continuous
is.regular <- function(x) {
# returns TRUE if vector x of POSIXct datetimes is continuous and regular
# by checking if there are more than one unique difftime between each row
x.difftime <- difftime(x[2:length(x)], x[1:(length(x)-1)], units='secs')
if (length(levels(factor(x.difftime))) > 1) {
return (FALSE)
} else {
return (TRUE)
}
}
@walkerjeffd
walkerjeffd / zoo_regular.R
Created August 7, 2013 23:02
R function for creating a regular and continuous zoo object from two vectors of dates/datetimes and values with optional fill values
zoo.regular <- function(dates, values, by="hour", fill=NA) {
# convert time series to regular zoo object
require(zoo)
z <- zoo(values, dates)
z <- merge(z, zoo(, seq(floor_date(start(z), 'day'),
ceiling_date(end(z), 'day'),
by)),
fill=fill)
z <- z[1:(length(z)-1)]
return(z)
@walkerjeffd
walkerjeffd / ggplot2.calendar
Last active December 20, 2015 02:29
Calendar Plot using ggplot2
require(lubridate)
require(plyr)
require(ggplot2)
theme_set(theme_bw())
# create random dataset
df <- data.frame(DATETIME = ymd("2000-01-01") + ddays(runif(100)*365*5))
# compute day/month columns
df <- mutate(df,
@walkerjeffd
walkerjeffd / README.md
Last active November 17, 2015 02:09
timeseries-uncertainty