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
print_xtable = function(table_in, | |
caption = "FILL IN CAPTION", | |
digits = NULL, | |
align = NULL, | |
include.rownames = F, | |
comment = F, | |
sanitize.text.function = function(x) x, | |
xtable.options = NULL, | |
return_xtable = F, | |
...){ |
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
extract_legend = function(plot_in, theme_in = theme(legend.position = "top")) | |
gtable::gtable_filter(ggplot_gtable(ggplot_build(plot_in + theme_in)), "guide-box") |
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(ggplot2) | |
library(RColorBrewer) | |
gg_color_hue <- function(n) { | |
hues = seq(15, 375, length = n + 1) | |
hcl(h = hues, l = 65, c = 100)[1:n] | |
} | |
n = 4 | |
cols = gg_color_hue(n) |
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
# Setting PATH for Python 3.5 | |
# The orginal version is saved in .bash_profile.pysave | |
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}" | |
export PATH | |
# added by Anaconda3 2.5.0 installer | |
#export PATH="/Users/bryanmayer/anaconda/bin:$PATH" | |
#export PYTHONPATH=/Users/bryanmayer/anaconda/bin/python:$PYTHONPATH |
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(xtable) | |
library(plyr) | |
fakedata = data.frame( | |
Bacteria = c("G. vaginalis", "L. crispatus"), | |
Count = log10(rlnorm(2*100, 13.5)) | |
) | |
table1 = ddply(fakedata, .(Bacteria), summarize, | |
Bacteria = paste("\\textit{",unique(Bacteria),"}", sep=""), |
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(ggplot2) | |
fakedata = data.frame( | |
Bacteria = c("G. vaginalis", "BVAB", "L. crispatus"), | |
Count = log10(rlnorm(3*100, 13.5)) | |
) | |
#create functions to map fontface and colour to bacteria category | |
#just using sapply | |
fontFaceFunction = function(bacteriaList) |
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(plyr) | |
testdata = data.frame( | |
ID = rep(c("A", "B", "C"), each = 6), | |
time = rep(seq(0, 5, 1), 3), | |
output = rnorm(3 * 6) | |
) | |
testdata = merge(testdata, | |
ddply( |