Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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(shiny) | |
library(DiagrammeR) | |
library(magrittr) | |
shinyServer(function(input, output) { | |
output$diagram_plot <- renderDiagrammeR({ | |
graph <- | |
create_graph() %>% | |
set_graph_name("Boxes and Circles") %>% | |
set_graph_time() %>% |
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(shiny) | |
iris <- datasets::iris | |
names(iris) <- gsub('[/.]','_',tolower(names(iris))) | |
shinyServer( | |
function(input, output) { | |
output$json <- reactive({ | |
paste('<script>data=', | |
RJSONIO::toJSON(iris[iris$species == input$species,], byrow=T, colNames=T), | |
';console.log(data[0]);', # print 1 data line to console |
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
FROM ubuntu:14.04 | |
MAINTAINER Winston Chang "winston@rstudio.com" | |
# ===================================================================== | |
# R | |
# ===================================================================== | |
# Need this to add R repo | |
RUN apt-get update && apt-get install -y software-properties-common |
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
#!/usr/bin/env bash | |
# This script prints out all of your Redis keys and their size in a human readable format | |
# Copyright 2013 Brent O'Connor | |
# License: http://www.apache.org/licenses/LICENSE-2.0 | |
human_size() { | |
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
} |
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
127.0.0.1 localhost | |
# The following lines are desirable for IPv6 capable hosts | |
::1 ip6-localhost ip6-loopback | |
fe00::0 ip6-localnet | |
ff00::0 ip6-mcastprefix | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters | |
ff02::3 ip6-allhosts |
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
> sessionInfo() | |
R version 3.0.2 (2013-09-25) | |
Platform: x86_64-apple-darwin10.8.0 (64-bit) | |
locale: | |
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 | |
attached base packages: | |
[1] stats4 parallel grid splines stats graphics grDevices | |
[8] utils datasets methods base |
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(muhaz) | |
fit2 <- muhaz(df$days_to_capture, | |
df$censor, | |
bw.method = "knn") | |
plot(fit2, xlim = c(0, 365.25), | |
ylab = "Hazard Rate", | |
xlab = "Days from being added to the list") |
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
difftime(Sys.time(), min(df$date_put_on_list[df$censor == 0]), units = "days") | |
Time difference of 15892.45 days | |
df$days_to_capture <- ifelse(df$id == 313, 15892.45, df$days_to_capture) | |
mean(df$days_to_capture[df$days_to_capture > 0 & (df$censor == 1 | df$id == 313)], na.rm = T) | |
# 435.1818 days |
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
df <- read.csv("data.csv", | |
header = T, | |
stringsAsFactors = F) | |
df$date_put_on_list <- as.POSIXct(df$date_put_on_list, format = "%m/%d/%Y", tz = "EST") | |
df$follow_up_date <- as.POSIXct(df$follow_up_date, format = "%m/%d/%Y", tz = "EST") | |
df$days_to_capture <- ifelse(is.na(df$follow_up_date) | df$follow_up_date == "", | |
difftime(Sys.time(), df$date_put_on_list, units = "days"), | |
difftime(df$follow_up_date, df$date_put_on_list, units = "days")) | |
df$censor <- ifelse(!is.na(df$follow_up_date), 1, 0) |