Skip to content

Instantly share code, notes, and snippets.

View bjurban's full-sized avatar

Bryan Urban bjurban

View GitHub Profile
@Btibert3
Btibert3 / flat-table.css
Created June 17, 2014 01:14
My StackOverflow question on styling R Markdown tables with knitr::kable and CSS
.flat-table {
display: block;
font-family: sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 115%;
overflow: auto;
width: auto;
th {
background-color: rgb(112, 196, 105);
@agstudy
agstudy / gist:5013751
Last active December 14, 2015 02:29
transform data
transformdata <- function(dates, values, date.form = "%Y-%m-%d", ...) {
require(lattice)
require(grid)
require(chron)
if (class(dates) == "character" | class(dates) == "factor" ) {
dates <- strptime(dates, date.form)
}
caldat <- data.frame(value = values, dates = dates)
min.date <- as.Date(paste(format(min(dates), "%Y"),
@agstudy
agstudy / gist:5013606
Last active June 27, 2019 04:56
add division to the calendar.
calendar.division <- function(...)
{
xyetc <- list(...)
subs <- dat[xyetc$subscripts,]
dates.fsubs <- dat[dat$yr == unique(subs$yr),]
y.start <- dates.fsubs$dotw[1]
y.end <- dates.fsubs$dotw[nrow(dates.fsubs)]
dates.len <- nrow(dates.fsubs)
adj.start <- dates.fsubs$woty[1]
@abelsonlive
abelsonlive / R: New calendarHeat
Created May 17, 2012 06:34
R: modify calendarHeat map to allow custom breaks and RColorBrewer functionality
require("lattice")
require("makeR")
####################################################################
####################################################################
####################################################################
####################################################################
levelplot.forumula <- function (x, data = NULL, allow.multiple = is.null(groups) ||
outer, outer = TRUE, aspect = "fill", panel = if (useRaster) lattice.getOption("panel.levelplot.raster") else lattice.getOption("panel.levelplot"),