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
#### Intended for use with the `redcapAPI` package | |
#' @name missingSummary | |
#' @aliases missingSummary.redcapApiConnection | |
#' @aliases missingSummary.redcapDbConneciton | |
#' @aliases missingSummary_offline | |
#' @export missingSummary | |
#' @export missingSummary.redcapApiConnection | |
#' @export missingSummary.redcapDbConnection | |
#' @export missingSummary_offline | |
#' |
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
#* More examples at https://gist.github.com/nutterb/fb19644cc18c4e64d12a | |
#' @name ggSurvGraph | |
#' @export ggSurvGraph | |
#' @import ggplot2 | |
#' @importFrom grid unit | |
#' @importFrom gridExtra grid.arrange | |
#' @importFrom plyr arrange | |
#' @importFrom plyr ddply | |
#' @importFrom reshape2 melt | |
#' @importFrom zoo na.locf |
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
#* You'll have to source in the function code from the gist | |
#* https://gist.github.com/nutterb/004ade595ec6932a0c29 | |
library(ggplot2) | |
install.packages("KMsurv") | |
data(kidney, package="KMsurv") | |
fit <- survfit(Surv(time, delta) ~ type, data=kidney) | |
ggSurvGraph(fit) | |
ggSurvGraph(fit, conf.bar=FALSE) |
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(dplyr) | |
library(tidyr) | |
choose_partner <- function(People){ | |
Males <- filter(People, gender == "M") | |
Females <- filter(People, gender == "F") | |
if (nrow(Males) <= nrow(Females)){ | |
Males$partner_id <- sample(Females$id, nrow(Males)) | |
People <- full_join(Males, Females, |
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
pi_birthdays <- function(birthdate, n = 1:30, format = "%Y-%m-%d"){ | |
if (!is.Date(birthdate) | !is.POSIXct(birthdate)){ | |
birthdate <- as.Date(birthdate, format = format) | |
} | |
data.frame(n_pi = n, | |
pi_date = birthdate + 365.2425 * n * pi) | |
} |
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
#* A broader experiment on this stack overflow question | |
#* http://stackoverflow.com/questions/33298196/how-to-avoid-a-double-for-loop-when-accessing-all-combinations-of-colums-of-a-ma/33301080?noredirect=1#comment54403634_33301080 | |
#* I really need to find something better to do with my Friday mornings | |
#* Change n to make a larger experiment | |
n <- 1000 | |
#* Change reps to run more cycles in 'microbenchmark' | |
reps <- 10 |
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) | |
ui <- shinyUI( | |
fluidPage( | |
dateInput(inputId = "date", | |
label = "Signature Date", | |
value = ''), | |
actionButton(inputId = "save_signature", | |
label = "Print Signature"), | |
verbatimTextOutput("date_value"), |
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
# Copy and paste the code below into the textArea input when the application is running. | |
# Header 1 | |
## Header 2 | |
### Header 3 | |
#### Header 4 | |
##### Header 5 | |
It would be really helpful to include a link to a markdown cheat sheet. [This is a good example](http://support.mashery.com/docs/read/customizing_your_portal/Markdown_Cheat_Sheet) of where to get a good rundown of basic markdown. |
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
directorySearch <- function(dir, pattern, ...) | |
{ | |
files <- list.files(dir) | |
suppressWarnings( | |
Code <- lapply(file.path(dir, files), | |
readLines) | |
) | |
files[vapply(Code, |
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
medley_all_border <- function(x, part = c("table")) | |
{ | |
part <- | |
match.arg(part, | |
c("table", "head", "body", "interfoot", "foot"), | |
several.ok = TRUE) | |
part <- | |
if ("table" %in% part) | |
{ | |
c("head", "body", "interfoot", "foot") |
OlderNewer