R | LaTeX | Sudo | Stan | Grants | Grad School | Peer Review | Writing


Learning R? Try swirl.
Quick-R, one of the friendliest R places on the web, with many handy things including a reminder of what all those graphical parameter codes lead to. Though for adjusting margins I always like this page.
Master Jim Regetz shared his amazing R primer with me, so I am passing it along to the rest of the world. There is much amazing about this primer, including the eternal wisdom of: ‘There is really no reason you should ever have to struggle through something alone in R’ and much more. 
UCLA provides a nice breakdown of repeated-measures ANOVA here. And they have list of more R resources. And here’s a nice explanation of random slopes models
One R tip a day.
Matlab users, a couple translations.
Search engine specific for R.
Refcard for R.
R and your Mac, a big bunch of stuff from cran.
My book to live by is Venables & Ripley’s Modern Applied Statistics.
GLMM wiki, with a focus on lme and lme4 in R. Be sure to check out the package comparison. Also, Ben has posted some nice examples here.
How to interpret model coefficients. And a fun visual intro to hierarchical modeling. Want more? Try these lectures from Richard McElreath: video 1 and video 2
Down with for loops! Or so they all say, here’s how to remember the applies.
Types of sums of squares: Make sure you know which you’re using, want type III? Try the car package or check out your options(contrasts) or magically always have a perfectly balanced design. Also consider why you want which type you want.
Switching a column from factor to numeric? Be sure to ask for as.numeric(as.character(myfactorcolumn)) when you do. Better yet you can start all your code with: options(stringsAsFactors=FALSE) and prevent R from going all factor-crazy.
Annoyed that lmer doesn’t have p-values? Read this.
Hadley Wickham has made my R skills in many ways old, and out of date. To catch up on the present I challenge myself to watch this video where Hadley tells us how to manage many models in R. Info on purr here. And there are great cheatsheets from R Studio on wrangling data and using ggplot, and adjusting ggplot themes
Other R things I aim not to forget: choosing colors (including the viridis), trouble-shooting and getting help in R.

LaTeX & Sweave

Detexify: By far the most brilliant resource, draw your symbol and code options come up.
LaTeX and Sweave: Eli Holmes’ workshop on LaTeX: Super easy friendly and useful directions to get LaTeX running on your machine — and then get Sweave running, with some basic instructions for getting your coding life in LaTex and Sweave going. Start with “files to download” and get the Sweave files. Then work through the Sweave files under the tabs, set-up, lecture, and exercises.
Wrapfig: I am always looks for suggestions on making wrapfig and I play better together. One I heard recently: “If you want your picture to wrap a paragraph, put the wrapfig environment in front of it and leave some blank lines after the wrapfig environment in your source.” And, using floats in posters.
LaTeX wikibook: So many of your questions answered in one place.
Nice and short, a refcard for LaTeX.
And a not-so-short intro to LaTeX.
Sweave: Once you have it installed and know LaTeX and R, there’s not much to it, but I did lead a workshop on some of the basics (files here on git, or here). You can also download the manual, you can also download it directly from  here. Friedrich Leisch is the author of Sweave and used to maintain a good set of FAQs (I will keep an eye out for its return). I also recommend Charlie Geyer’s page here as a good resource. (And if somehow you missed it, read up four paragraph for my recommendation of Eli Holmes’ site on Sweave & LaTeX.)
Tex gallery of images
BibDesk: If you use LaTeX and you have references, then you’ll use BibTex. I use BibDesk to manage my BibTex stuff. And some BibTex styles. Here’s a quick review of bib stuff
LaTeX to rtf: Small, simple and sweet, just install yourself and call latex2rtf “myfilepath” at the command line.
Beamer! Now that you know LaTeX you can start making all your presentations in Beamer and start making animated pdfs.
Word to LaTeX: Great little tool to export Open Office docs to LaTeX. Just download the program, then in Open Office, go to Tools -> Extension Manager and add the new extension (.oxt) and poof! Like magic you can now export all your docs to LaTeX. I will say that it is UGLY code, but it’s good to get you started. You can open a new tex doc and pull out the good chunks.
White space in LaTeX: LaTeX’s formatting is so lovely that initially you wonder why anyone would mess with it, and then a grant is due and you’re looking for every trick in the book. You can still get a lot of the pretty and trim space by using a slew of tricks including using smaller font in the main text and refs, and some of these tricks including trimming that linespread, and then if you’re still desperate check out what the engineers at Cambridge or the general UK TeX folks suggest. Happy page limiting.
Cleaning up intermediate files: When compiling your code LaTeX vomits up a bunch of ugly intermediate files. There’s lots of ways to get rid of them, for emacs AucTex will allow you toss them. After compiling use the command (after C-c C-c) ‘Clean’ to toss them or ‘Clean All’ to toss them plus the output files.You can also customize disposal however you like (for example, don’t trash them, put them somewhere you define etc.).
LaTeX can be a bit of pain in letter format, you can add numbers, and you can add a bibliography; it’s just not pretty. 
How to add S to all your supplemental tables and figures? Put this towards the top of your file somewhere after begin{document}: 

Sudo, etc.

My favorite text editor is Aquamacs. I use it for R, LaTeX and most other stuff. This page has some hints and here’s more good info
When make won’t work remember sudo.
A nice Introduction to Unix
Maxima: open-source symbolic math program (what I use to solve the nastier equations).
Sage: another open-source math program (I want to try this someday).
Version control (such as Subversion or Git) so you can keep track of versions of all your files, works especially well with code. The most common git problem we have in the lab is with SSH keys. Also, here’s how to delete stuff from repo without deleting form your disk.
Project management software to help you keep track of all your work (such as redmine).
A helpful builder for regular expressions.
Some helpful links about relative paths.
Trying to get certain files on github to display properly? Try replacing the file link with to This is a third-party server that can display html files, among other things.
Need to compare files? Try filemerge or such …

Stan (and Bayesian Stuff)

Posterior probabilities explained via Star Wars.
Trying to code your first Stan model? Many of the models in Gelman & Hill are translated into Stan already.
There’s also a nice, simple three-level example here.
And, information on how to pick your priors
Phylogenetic mixed models made easy in BRMS, vignette here.
Gaussian processes in Stan, by MikeNegative binomials in Stan. 
Lots of population analysis code translated from WinBUGS into Stan here.
Eugene Quinn awesomely teaches his Statistics in Science class in Stan, check it out
Two good webinars on Stan: Introduction to Bayesian Data Analysis and Stan with Andrew Gelman and an Introduction to the rstanarm package
I have not tried these but a few more links people might find useful: Packages that help you use Stan without coding in Stan, also here (note: do not try to look at Stan code created by rstanarm, it won’t help you learn Stan). How to do an RM-ANOVA in Stan. And Max Farrell’s workshop on Stan (including rstanarm) from April 2017 hereBayesian for hackers
Super cool comparison of MCMC samplers!
Info on loo
Want to know a lot about Stan? You can read the paper on it here. Or, learn a lot less and watch this fun trailer. 


Miscellaneous: Center for Invasive Plant Management’s info
Postdoc: NSF’s Postdoctoral Research Fellowships in Biology
Postdoc: NSERC’s Postdoctoral Fellowship program
Postdoc: UC-Davis’ Center for Population Biology (CPB) Postdoctoral Fellowship
Postdoc: Earth Institute at Columbia fellowship program
Postdoc: Smith Fellowship from the Society for Conservation Biology
Postdoc: Luc Hofflan Institute Fellows Program
Postdoc: Liber Ero Fellowship, modeled on Smith Fellowship but set in Canada
Postdoc: Miller Fellowship program at UC-Berkeley
Postdoc: Cornell Fellowship program 
Postdoc: UC Presidents Fellowship Program
Postdoc: Biodiversity Research Centre Fellowships at the University of British Columbia
Postdoc: Departmental Postdoctoral Fellowships in the areas of Ecology and Evolutionary Biology at University of Toronto (2017-2018 ad)
Centre postdocs: at NIMBios, or SESYNC, or, possibly most awesomely, at the Santa Fe Institute
Postdoc: Tupper Fellowship program through the Smithsonian Tropical Research Institute (STRI), other options here
Postdocs at Harvard University (three): Environmental Fellows program at Harvard University Center for the Environment (HUCE), Harvard Junior Fellows Program, Arnold Arboretum Putnam Fellows in Plant Science.

Grad School

Two wise people told me people go to grad school for a total sum of seven reasons (I went for two of them); here’s a post though on a 100 reasons not to go and Ms Mentor’s perspective on it. For those going, here are the names of some grants to consider:
EPA STAR program
NSF’s “predoc” program, Graduate Research Fellowship program
NASA’s Graduate Student Researcher’s program (GSRP)
NASA’s ESS Fellowship in Earth Science (NESSF
And a few more …. Cornell’s database

Peer Review

I am convinced my friend Kim Nicholas set off a spate of interest and information in how to review (articles, generally) with her 2011 article in EOS, A Quick Guide to Writing a Solid Peer Review. You can read a follow-up from Nature here. There’s also the lovely, though rather giant, British Ecological Society’s Guide here. And ask around.
She also has some good info on data management.


I spent a lot of time during my dissertation procrastinating about writing by reading about writing. Some of my favorites from this period are:
How to Write a Lot: A Practical Guide to Productive Academic Writing by Paul Silvia is probably the best because you can’t spend too long reading it but it lays out all the rules (which are: to write a lot, you need to sit down and write, regularly). Also, maybe start an agraphia group.
On Writing Well: The Classic Guide to Writing Non-fiction by William Zissner is just a beautiful book, with all sorts of fantastic and depressingly simple advice, written so well that you can re-read it many times.
Stuff by Robert Boice is also good, such as the writing section of Advice for New Faculty Members, it shows some graphs in case you still want to believe spontaneous writers write better.
Made to Stick by the Heath brothers is not written as well as I would like, but all the points are valid and not put together so well anywhere else (that I am aware of).
Of course there’s always Wiliiams’ Style: Lessons in Clarity & Grace (and the much smaller ‘Basics’ edition, often excellent for students) and the Chicago Manual of Style for arguments about whether you can capitalize a word after a semi-colon, plus they have a Manual for Writers of Research Papers, Theses and Dissertations that is handy.
Loehle’s classic on creativity in science compares your ideas to a zoo of animals, in a very good way.
Ms. Mentor gives generally good, realistic advice. Maybe you need to go somewhere to write: Whiteley Center or Playa.


Great Videos etc.