Jason Bryer jbryer

View gitbook.R
1 2 3 4 5 6 7 8 9 10
require(knitr)
 
#' Initializes a new Gitbook.
#'
#' This will initalize a new Gitbook in the given directory. When done, it will
#' also change the working directory.
#'
#' @author Jason Bryer <jason@bryer.org>
newGitbook <- function(dir) {
.Deprecated('This function has been moved to the gitbook R package. See http://jason.bryer.org/gitbook for more information')
View package.R
1 2 3 4 5 6 7 8 9 10
#' Simplified loading and installing of packages
#'
#' This is a wrapper to \code{\link{require}} and \code{\link{install.packages}}.
#' Specifically, this will first try to load the package(s) and if not found
#' it will install then load the packages. Additionally, if the
#' \code{update=TRUE} parameter is specified it will check the currently
#' installed package version with what is available on CRAN (or mirror) and
#' install the newer version.
#'
#' @param pkgs a character vector with the names of the packages to load.
View setFunctionParams.R
1 2 3 4 5 6 7 8 9 10
#' Set function parameters for debugging.
#'
#' Sets the defauls for the parameters in the given function witin an environment.
#'
#' @param fun the function whose parameters should be set.
#' @param envir the environment to set those parameters.
#' @param missing.value value to assign to parameters that do not have a defautl value.
#' @param overwrite should parameters already defined be overwritten.
setFunctionParams <- function(fun,
envir=.GlobalEnv,
View server.R
1 2 3 4 5 6 7 8 9 10
require(shiny)
require(shinyIncubator)
require(ggplot2)
 
theme_update(panel.background=element_blank(),
panel.grid.major=element_blank(),
panel.border=element_blank())
 
tickets <- as.data.frame(rbind(
c( '$1', 1, 15),
View getYearQuarter.R
1 2 3 4 5 6 7 8 9 10
#' Returns the year (fiscal or calendar) and quarter in which the date appears.
#'
#' This function will cut the given date vector into quarters (i.e. three month
#' increments) and return an ordered factor with levels defined to be the quarters
#' between the minimum and maximum dates in the given vector. The levels, by
#' default, will be formated as \code{FY2013-Q1}, however the \code{FY} and \code{Q}
#' can be changed using the \code{fy.prefix} and \code{quarter.prefix} parameters,
#' respectively.
#'
#' @param x vector of type \code{\link{Date}}.
View as.data.frame.list.R
1 2 3 4 5 6 7 8 9 10
#' Convert a list of vectors to a data frame.
#'
#' This function will convert a list of vectors to a data frame. This function
#' will handle three different types of lists of vectors. First, if all the elements
#' in the list are named vectors, the resulting data frame will have have a number
#' of columns equal to the number of unique names across all vectors. In cases
#' where some vectors do not have names in other vectors, those values will be
#' filled with \code{NA}.
#'
#' The second case is when all the vectors are of the same length. In this case,
View parse.codebook.r
1 2 3 4 5 6 7 8 9 10
#' Parse a codebook file with variable and level information.
#'
#' Parses a codebook file where lines starting at column zero (far left) represet
#' variable information (e.g. name, description, type) and indented lines
#' (i.e. lines beginning with white space, either tabs or spaces, etc.) represent factor
#' levels and labels.
#'
#' Note that white space at the beginning and end of each line is stripped before
#' processing that line.
#'
View xtable.decimal.r
1 2 3 4 5 6 7 8 9 10
require(xtable)
 
#' Prints a LaTeX table with numeric columns aligned on their decimal points.
#'
#' This function wraps the \code{\link{xtable}} and \code{\link{print.xtable}}
#' functions in the \code{xtable} package so that numeric columns are aligned
#' on their decimal place.
#'
#' See \url{http://jason.bryer.org/posts/2013-01-04/xtable_with_aligned_decimals.html}
#' for more information.
View varEntryDialog.r
1 2 3 4 5 6 7 8 9 10
#' Creates a dialog box using tcl/tk to get input from the user.
#'
#' This function will create a tcl/tk dialog box to get user input. It has been
#' written to be extensible so the R programmer can easily create a dialog with
#' any number of varaibles with custom labels and data conversion of the user
#' entered data. The function will return a list where the element names are
#' \code{vars} and the value is the user input. By default, all entry will be
#' converted using the \code{as.character} function. However, this can easily be
#' altered using the \code{fun} parameter. For example, if integers are required,
#' use \code{fun=c(as.integer, ...)}. It is also possible to write custom
View ggplot2Cheat.r
1 2 3 4 5 6 7 8 9 10
require(ggplot2)
require(grid)
 
theme_update(panel.background=theme_blank(),
panel.grid.major=theme_blank(),
panel.border=theme_blank())
 
#Borrowed (i.e. stollen) from http://research.stowers-institute.org/efg/R/Color/Chart/ColorChart.R
getColorHexAndDecimal <- function(color) {
if(is.na(color)) {
Something went wrong with that request. Please try again.