This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(reshape2) | |
weather <- read.csv('DisneyMarathonWeather.csv') | |
weather.melt <- melt(weather[,c('Year', 'Low', 'High', 'Wind', 'StartHumidity', 'Sky')], | |
id.vars = c('Year', 'Wind', 'StartHumidity', 'Sky')) | |
ggplot(weather.melt, aes(x = Year)) + | |
geom_ribbon(data = weather, aes(ymin = Low, ymax = High), alpha = 0.3, fill = 'skyblue') + | |
geom_path(aes(y = value, group = variable)) + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' 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}}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is modified by Jason Bryer (jason@bryer.org) from Huidong Tian's | |
# original script. The blog post describing the method is here: | |
# http://withr.me/authentication-of-shiny-server-application-using-a-simple-method/ | |
# The original R script is located here: https://gist.github.com/withr/9001831 | |
# | |
# This script adds two new features: 1. Render a logout button, and 2. provide | |
# the ability for visitors to create a new account. | |
# | |
# Within your server.R file, be sure to use: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#List of most used R packages that we wish to install. | |
libraries = c('cacheSweave', 'Deducer', 'devtools', 'doBy', 'foreign', 'gdata', | |
'ggplot2', 'Hmisc', 'JGR', 'lubridate', 'maps', 'mapdata', 'mapproj', | |
'maptools', 'proto', 'psych', 'R2wd', 'RCurl', 'reshape', | |
'RODBC', 'roxygen2', 'seqinr', 'sm', 'sp', 'sqldf', 'survey', | |
'WriteXLS', 'XML', 'xtable') | |
#We will install packages from the main CRAN site | |
repos = 'http://cran.r-project.org' | |
#Site provides some prebuilt binaries for Windows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(reshape2) | |
library(lubridate) | |
library(rnoaa) | |
token <- '' # Get token here: https://www.ncdc.noaa.gov//cdo-web/token | |
options(noaakey = token) | |
marathon_dates <- c('2021-01-10','2020-01-12','2019-01-13', | |
'2018-01-07','2017-01-08','2016-01-10','2015-01-11','2014-01-12', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the App on a Shiny Server | |
library(shiny) | |
source('shiny_param_test.R') | |
shiny::shinyApp(ui = shiny_ui, | |
server = shiny_server) |