This file contains hidden or 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
packageStartupMessage(" | |
##********* Surgical Science **********## | |
# -------------------------------- # | |
# Medical Outcomes Analysis # | |
# -------------------------------- # | |
# Comparison of daVinci Robotic # | |
# Surgery Patients and Patients # | |
# of other surgical modalities # | |
# -------------------------------- # | |
# # |
This file contains hidden or 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
# DEFINE HELPER FUNS AND SET INIT OPTIONS --------------------------------- | |
options(devtools.name = "Bobby Fatemi") | |
options(devtools.desc.license = "file LICENSE") | |
options(devtools.desc.author = 'person(email = "[email protected]", role = c("aut", "cre"), given = "Bobby", family = "Fatemi")') | |
options(devtools.desc = list( | |
Description = "[DOCUMENTATION NEEDED] DESCRIPTION.", | |
Title = "[DOCUMENTATION NEEDED] TITLE") | |
) |
This file contains hidden or 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
DT <- as.data.table(iris) | |
DT[, MONTHS := sample(month.abb, size = .N, replace = TRUE)] | |
DT[, LETTERS := sample(LETTERS[rep(1:5, 3)], size = .N, replace = TRUE)] | |
DT | |
grp1 <- c("Species", "LETTERS") | |
grp2 <- c("MONTHS") | |
resDT <- DT[, .(grpDT = { | |
res <- list(as.data.table(.SD)[, .N, grp2]) | |
res |
This file contains hidden or 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(shinyjs) | |
load_data <- function() { | |
Sys.sleep(2) | |
hide("loading_page") | |
show("main_content") | |
} | |
ui <- fluidPage( |
This file contains hidden or 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
install.packages("quantreg") | |
pdt <- dt[durProc < 400 & | |
ExpIndex < 500 & | |
ExpIndex > 4] | |
pdt2 <- pdt[, .(aveDur = mean(durProc)), ExpIndex][order(ExpIndex)] | |
m <- ggplot(pdt2, aes(ExpIndex, aveDur)) + |
This file contains hidden or 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
ABC <- local({ | |
x <- 1 | |
function(v) { | |
if (missing(v)){ | |
cat("get\n") | |
} else { | |
cat("set\n") | |
x <<- v | |
} | |
x |
This file contains hidden or 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
# Usecases: | |
# when creating many R environments and each have independent data-set | |
ll <- list( | |
as.factor(c(2001, 2002, 2004, 2006)), | |
I(c(2001, 2002, 2004, 2006)), | |
ordered(c(2001, 2002, 2004, 2006)), | |
as.double(c(366.3240, 365.4124, 366.5323423, 364.9573234)), |
This file contains hidden or 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
# Change directory to the current Finder directory | |
cdf() { | |
target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'` | |
if [ "$target" != "" ]; then | |
cd "$target"; pwd | |
else | |
echo 'No Finder window found' >&2 | |
fi | |
} |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
set -u | |
# | |
# GROUP: min user access... | |
# - can connect to database | |
# - can access schema | |
# - can read schema tables | |
# |
This file contains hidden or 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
## | |
## POSTGRES LITE DOCKERFILE- create db, user/pwd, and open listening | |
## | |
FROM postgres:11.1-alpine | |
ADD ./init.sh /docker-entrypoint-initdb.d/. | |
ENV PGDATA /var/lib/postgresql/data | |
EXPOSE 5432 |