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
# outline the packages needed for this script | |
# pak::pkg_install("hadley/requirements") | |
# requirements::req_file("SNP_saturation.R") | |
# Input 1-2 sentences that describe what this does, when it was done, and why | |
if (!requireNamespace("parallel", quietly = TRUE)) { | |
install.packages("parallel") | |
} |
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(tidyverse); library(rstan) | |
# Some fake data | |
Individuals <- 1000 | |
Sims <- 1000 | |
Months <- 20 | |
initial_values <- data.frame(customer_id = 1:Individuals, initial_value = rnorm(Individuals)) |
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
' Windows Devs said on the developer feedback asking for cron, deamons and background tasks: | |
' "This first release of Bash/WSL doesn’t support background tasks, cron jobs, daemons, etc. | |
' Currently, when you close your last bash shell console window, we tear-down the Linux process | |
' chain in order to conserve resources." | |
' | |
' That's the workaround for now. | |
' You can run it on boot, for example, and it'll keep a instance of bash running alone in the background | |
' allowing background processes to run on WSL. | |
Set WshShell = CreateObject("WScript.Shell") |
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
# Function to plot color bar | |
color.bar <- function(lut, min, max=-min, nticks=11, ticks=seq(min, max, len=nticks), title='') { | |
scale = (length(lut)-1)/(max-min) | |
dev.new(width=1.75, height=5) | |
plot(c(0,10), c(min,max), type='n', bty='n', xaxt='n', xlab='', yaxt='n', ylab='', main=title) | |
axis(2, ticks, las=1) | |
for (i in 1:(length(lut)-1)) { | |
y = (i-1)/scale + min | |
rect(0,y,10,y+1/scale, col=lut[i], border=NA) |