knitr table and figure functions for Rmd
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
pasteLabel <- function(preText, inObj, objName, insLink=TRUE){ | |
objNum <- inObj[objName] | |
useText <- paste(preText, objNum, sep=" ") | |
if (insLink){ | |
useText <- paste("[", useText, "](#", objName, ")", sep="") | |
} | |
useText | |
} | |
# this increments the counter, and gives a name to the number so we can reference it later | |
incCount <- function(inObj, useName){ | |
nObj <- length(inObj) | |
useNum <- max(inObj) + 1 | |
inObj <- c(inObj, useNum) | |
names(inObj)[nObj+1] <- useName | |
inObj | |
} | |
figCount <- c("_"=0) | |
tableCount <- c("_"=0) | |
tableCat <- function(inFrame){ | |
outText <- paste(names(inFrame), collapse=" | ") | |
outText <- c(outText, paste(rep("---", ncol(inFrame)), collapse=" | ")) | |
invisible(apply(inFrame, 1, function(inRow){ | |
outText <<- c(outText, paste(inRow, collapse=" | ")) | |
})) | |
return(outText) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment