Publications by Scott Chamberlain
Troubling news for the teaching of evolution
A recent survey reported in Science (“Defeating Creationism in the Courtroom, but not in the Classroom”), suggests that high school teachers are not teaching evolution to the fullest extent, say, that grammar is being taught in the English classroom. According to survey, biology teachers in high school do not often accept the b...
1699 sym R (2449 sym/3 pcs) 2 img
Phenotypic selection analysis in R
I have up to recently always done my phenotypic selection analyses in SAS. I finally got some code I think works to do everything SAS would do. Feedback much appreciated!########################Selection analyses############################# install.packages(c("car","reshape","ggplot2")) require(car) require(reshape) require(ggplot2) ...
622 sym R (2293 sym/1 pcs) 4 img
Five ways to visualize your pairwise comparisons
In data analysis it is often nice to look at all pairwise combinations of continuous variables in scatterplots. Up until recently, I have used the function splom in the package lattice, but ggplot2 has superior aesthetics, I think anyway. Here a few ways to accomplish the task: # load packages require(lattice) require(ggplot2) ...
1563 sym R (1452 sym/7 pcs) 10 img
basic ggplot2 network graphs
I have been looking around on the web and have not found anything yet related to using ggplot2 for making graphs/networks. I put together a few functions to make very simple graphs. The bipartite function especially is not ideal, as of course we only want to allow connections between unlike nodes, not all nodes. These functions do not...
872 sym R (2164 sym/3 pcs) 6 img
basic ggplot2 network graphs – ver2
I posted last week a simple function to plot networks using ggplot2 package. Here is version 2. I still need to work on figuring out efficient vertex placement.Changes in version 2:-You have one of three options: use an igraph object, a matrix, or a dataframe (matrices will be converted to data frames within the function)-If you have ...
1711 sym R (5001 sym/3 pcs) 8 img
Phylometa from R – UDPATE
A while back I posted some messy code to run Phylometa from R, especially useful for processing the output data from Phylometa which is not easily done. The code is still quite messy, but it should work now. I have run the code with tens of different data sets and phylogenies so it should work. I fixed errors when parentheses came up against nu...
1390 sym 2 img
Adjust branch lengths with node ages: comparison of two methods
Here is an approach for comparing two methods of adjusting branch lengths on trees: bladj in the program Phylocom and a fxn written by Gene Hunt at the Smithsonian.Get the code and example files here: http://wp.me/PRT1F-2vGet phylocom here: http://www.phylodiversity.net/phylocom/The code uses as input a newick tree file and a text fi...
898 sym R (876 sym/1 pcs) 4 img
Phylometa from R: Randomization via Tip Shuffle
I wrote earlier about some code I wrote for running Phylometa (software to do phylogenetic meta-analysis) from R.I have been concerned about what exactly is the right penalty for including phylogeny in a meta-analysis. E.g.: AIC is calculated from Q in Phylometa, and Q increases with tree size.So, I wrote some code to shuffle the tips of your tre...
1927 sym R (3608 sym/2 pcs) 4 img
Running Phylip’s contrast application for trait pairs from R
Here is some code to run Phylip’s contrast application from R and get the output within R to easily manipulate yourself. Importantly, the code is written specifically for trait pairs only as the regular expression work in the code specifically grabs data from contast results when only two traits are input. You could easily change th...
1529 sym R (1043 sym/1 pcs) 2 img
Processing nested lists
So perhaps you have all figured this out already, but I was excited to figure out how to finally neatly get all the data frames, lists, vectors, etc. out of a nested list. It is as easy as nesting calls to the apply family of functions, in the case below, using plyr’s apply like functions. Take this example:# Nested lists code, an e...
712 sym R (858 sym/1 pcs) 2 img