Download and install:
- R
- RStudio
Download the dummy csv file from this gist ( https://gist.github.com/psychemedia/9690079 )
In RStudio run:
install.packages("shiny")
| #' 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. |
| example.md: example.Rmd | |
| ./knit | |
| example.ipynb: example.md | |
| notedown example.md | sed 's/%%r/%%R/' > example.ipynb |
Download and install:
Download the dummy csv file from this gist ( https://gist.github.com/psychemedia/9690079 )
In RStudio run:
install.packages("shiny")
| #’ Create a Kaplan-Meier plot using ggplot2 | |
| #’ | |
| #’ @param sfit a \code{\link[survival]{survfit}} object | |
| #’ @param returns logical: if \code{TRUE}, return an ggplot object | |
| #’ @param xlabs x-axis label | |
| #’ @param ylabs y-axis label | |
| #’ @param ystratalabs The strata labels. \code{Default = levels(summary(sfit)$strata)} | |
| #’ @param ystrataname The legend name. Default = “Strata” | |
| #’ @param timeby numeric: control the granularity along the time-axis | |
| #’ @param main plot title |
| options(PlosApiKey = "<insert your API key here!>") | |
| #install_github("rplos", "ropensci") | |
| library("rplos") | |
| library("ggplot2") | |
| require("dplyr") | |
| # Convert author strings to counts | |
| countAuths <- function(cell) | |
| length(unlist(strsplit(cell, ";"))) |
| library(plyr) | |
| library(ggplot2) | |
| library(ggmap) | |
| libraries = read.csv("ontario_library_stats_2010.csv") | |
| libraries$isFN = ifelse(libraries$Library.Service.Type == "First Nations Library",1,0) | |
| # Here we create the 'proportionate' versions of all the variables | |
| libraries[,143:265] = sapply(libraries[,20:142], function (x) x/libraries[,13]) | |
| names(libraries)[143:265] = paste(names(libraries)[20:142], "P",sep=".") |
| require(ipeds) | |
| require(ggplot2) | |
| require(reshape2) | |
| require(scales) | |
| data(surveys) | |
| View(surveys) | |
| # Directory | |
| ipedsHelp('HD', 2012) |
| library(MCMCpack) | |
| ## Coping with polls: the more recent, the better they are. | |
| ##http://en.wikipedia.org/wiki/Opinion_polling_for_the_Scottish_independence_referendum,_2014 | |
| polls = NULL | |
| polls <- data.frame( rbind( | |
| Survation = c(37, 50, 1010), | |
| YouGov = c(35, 55, 1142), | |
| TNSBMRB = c(32, 45, 1003), | |
| IpsosMORI = c(40, 54, 1006), |
| library("RSiteCatalyst") | |
| library("d3Network") | |
| #### Authentication | |
| SCAuth("key", "secret") | |
| #### Get Pathing data: Single page, then ::anything:: pattern | |
| pathpattern <- c("http://randyzwitch.com/big-data-hadoop-amazon-ec2-cloudera-part-1", "::anything::") | |
| next_page <- QueuePathing("zwitchdev", | |
| "2014-01-01", |