Michael's Code

Table of Contents

1 R Statistical Computing

1.1 Survival Plot

This is a simple example of a survival plot. You can do quite a few interesting things with Survival plots - for instance, in a lot of human factors simulation research, you can examine time to event detection or system failure.

install.packages("survminer")
install.packages("ggthemes")

library(survminer)
library(survival)

survdats <- read.csv("C:/Users/micha/Downloads/survival.csv")
autoplot.survfit(surv)

sfit <- (survfit(Surv(survdats$survival)~1))


ggsurvplot(sfit, conf.int=TRUE, pval=FALSE, risk.table=FALSE, 
           color=c("dodgerblue2"), 
           main="Kaplan-Meier Curve for Automation Failure Detection",
           ylab = "Survival Probability",
           font.tickslab = 16,
           conf.int.style = "step",
           break.x.by = 50,
           ggtheme = theme_bw(),
           font.x = c(16, "bold"),
           font.y = c(16))

1.1.1 TODO Add the data for this

1.2 Populating a Tibble   dplyr

fill.tibb <- tibble(
  subjectid = rep(unique(props.offonextra$subjectid),each=6),
  period = rep(c("Offwatch", "Onwatch"), 48),
  offonextra = rep(c("ON-REST", "ON-WORK",
                     "OFF-WORK", "OFF-REST", "OFF-NA", "ON-NA"),
                   length(unique(props.offonextra$subjectid))),
  time = 0,
  prop = 0
) 

Date: 2018-06-19 Tue @ 21:14

Created: 2018-06-19 Tue 22:33

Validate