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
CoefficientPlot <- function(models, alpha = 0.05, modelnames = ""){ | |
# models must be a list() | |
Multiplier <- qnorm(1 - alpha / 2) | |
CoefficientTables <- lapply(models, function(x){summary(x)$coef}) | |
TableRows <- unlist(lapply(CoefficientTables, nrow)) | |
if(modelnames[1] == ""){ | |
ModelNameLabels <- rep(paste("Model", 1:length(TableRows)), TableRows) | |
} else { |
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
Projector <- function(st, loopover, iteration){ | |
Currently <- Sys.time() | |
Elapsed <- (Currently - st) * length(loopover)/which(iteration == loopover) | |
units(Elapsed) <- "mins" | |
return(st + Elapsed * 60) | |
} | |
StartTime <- Sys.time() | |
for(oo in c(1:50)){ | |
print(oo) |
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
GroupRank <- function(x, group){ unsplit(lapply(split(-x, group), rank), group) } |
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
lineFinder <- function(string, vector){ (1:length(vector))[regexpr(string, vector) != -1] } |
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
makeTable <- function(vector, toregex){ do.call(rbind, strsplit(vector, toregex)) } |
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
Pad0 <- function(x, mx=NULL, fill=0) { | |
## pad numeric vars to strings of specified size | |
lx <- nchar(as.character(x)) | |
mx.calc <- max(lx, na.rm=TRUE) | |
if (!is.null(mx)) { | |
if (mx<mx.calc) { | |
stop("number of maxchar is too small") | |
} | |
} else { | |
mx <- mx.calc |
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
Reorderer <- function(tofactor, inorder){ factor(tofactor, levels = tofactor[order(inorder)]) } |
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
SmoothCoefficientPlot <- function(models, modelnames = "", removeintercept = FALSE){ | |
# models must be a list() | |
Alphas <- seq(1, 99, 2) / 100 | |
Multiplier <- qnorm(1 - Alphas / 2) | |
zzTransparency <<- 1/(length(Multiplier)/4) | |
CoefficientTables <- lapply(models, function(x){summary(x)$coef}) | |
TableRows <- unlist(lapply(CoefficientTables, nrow)) |
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
spaceTrim <- function(x){ gsub("(^ +)|( +$)", "", x) } |
OlderNewer