- *Book: R Graphics, Second Edition, by Paul Murrell. Amazon link. A thorough treatment on using Lattice and Base graphics, an alternative to ggplot2.
- Book: Lattice: Multivariate Data Visualization with R, by Deepayan Sarkar, author of the lattice package. Book link (Springer). Link to companion website (figures and code)
- Learn R - The blog of someone trying to learn to use R to create different types of graphs. Contains a fantastic collection of figures originally generated in lattice, then reproduced in ggplot2, along with code used to generate the figures. Great if you're trying to figure out how to create a particularly complex sort of visualization and want to determine your options.
Programming (suggestions by Thomas Olszewksi)w
Misc. sample scripts for data analysis and visualization
- Sample Response Surface plot and analysis.R. When dietary experiments involve manipulation of two or more nutrients, the consequences should be examined in multidimensional "nutrient space." The first step is statistical analysis, completed here using the R package rsm, which - importantly! - restructures the axes of the predictor variables (e.g. amount of protein and carbohydrate) and then allows tests of linear, quadratic, and nutrient interaction effects on a dependent variable chosen by the investigator. The second step is a visual representation of the data. This relies on a non-parametric approach from the package fields, which has a function to fit thin-plate splines to the data and generate a nice image. I am currently working on developing equally beautiful figures that are "faceted" for further comparisons with a standardized the Z-axis scale (e.g. if one wanted to compare males vs. females); the current state of this project can be found here on stackoverflow.com
- Basic Function Example. A powerful use for R is the ability to perform recursive calculations without altering the original data. This simple example shows how to write a function to repeatedly perform a calculation and output the results.
- Cricket Dietary Analysis Files. These are in-depth scripts used to generate plots and conduct statistical analyses of cricket feeding behavior. Note that some of the ggplot2 syntax is out-of-date, but the changes should not cause the code to break completely.
Open Source for Open Science: Evolution (November 7, 2014)
On November 7, 2014 I co-organized a one-day workshop to introduce members of the Ecology and Evolutionary Biology program at Texas A&M University to R and other open-source tools for evolution-themed data analysis and visualization. Here is a link to the workshop outline and materials.
Open Source for Open Science: An EEB Workshop (July 2014)
In July of 2014 I co-organized a 2.5-day workshop to introduce members of the Ecology and Evolutionary Biology program at Texas A&M University to R and other open-source tools for data analysis and visualization. Here is a link to the workshop outline and materials.
An Introduction to behavioral data manipulation and analysis with R: Sample scripts and data files (April 2012)
Behavioral data can quickly become voluminous and impossible to manage in spreadsheet programs. Scripting programs are an excellent way to grapple behavioral data into shapes that can be analyzed and summarized. These resources were originally developed for the workshop "Using R for Behavioral Analyses" at Arizona State University on April 2-5, 2012.
- Data Overview (pdf) - General introduction to types of data, how to analyze them, and how to format data for reading files into R. Modified from a presentation put together by Melanie Frazier.
- ClarkExampleData.csv - Sample data for a basic scripting exercise.
- The scripts below are for the slightly more complicated work of preparing data for behavioral analysis. Generally, the first step will be to convert "raw" scan data into frequencies of behaviors. After that, behaviors that are part of the same task should be added together to calculate frequencies of tasks. Then you can start to ask and address questions about those tasks.
- CalculatingTaskFrequencies.R - This is a pretty hairy file, and it's also out-of-date because as it turns out we want to address some different questions. However, there are a lot of useful functions in here, and it's good practice for interpreting and editing scripts. You'll need the .csv that's generated by the script "ClarkScansToFreqs.R". I have also added a file (below) that tells you what the cryptic column titles mean.
Further Reading on Data Management - Creating Metadata
Fegraus, E.H., Andelman, S., Jones, M.B., and Schildhauer, M. (2005) Maximizing the value of ecological data with structured metadata: An introduction to Ecological Metadata Language (EML) and principles for metadata creation. Bulletin of the Ecological Society of America 86, 158-168.
Borer, E.T., Seabloom, E.W., Jones, M.B., and Schildhauer, M. (2009) Some simple guidelines for effective data management. Bulletin of the Ecological Society of America 90, 205-214.