Tag Archives: R

Interesting ways we can talk ourselves into productivity

Author: Brianna

This morning I’m working in pajamas, waiting for the utility company folks to send a person to look at the gas meter or whatever it is that they have to do that requires you to be home for a 4-hour window. The subject of my work is a manuscript that I’m rather fond of, one that I and my coauthors are aiming to get submitted next week.

But you know how the end of writing a paper goes: last 2% of the paper, what feels like 50% of the total work.


And yet, yesterday I wound up putting in quite a bit of revision and tidying. All this shortly after I’d pretty much written the afternoon off, because I was sleepy and we had lab meeting focused on a really challenging paper that more or less fried my brain for more complicated thinking. So what got me going?

A little task on my Google Calendar that said “Add references for R packages to PC horses paper.”

Because, hey, adding references for R packages is pretty easy and doesn’t require a lot of effort! And my time-tracking app was showing me that I wasn’t putting on much of a good show yesterday. (This is why I have one: to keep me honest.) So I decided I’d rack up a few more points minutes with an easy task.

Well, you know where the rest of this story goes. I added a short paragraph citing the R packages after tracking them all down and adding them to Zotero. I corrected some numbers on the manuscript that had changed a bit when I fixed a mistake in the code. I wrote a new caption for a figure that had changed considerably and then changed the main paper text to reflect the new figure. I found a couple places to improve our phrasing. Then I wandered over to the Discussion section that needed a little more love and found myself revising, and then adding new text…

All that from a Very Easy Item on a to-do list that I happened to see when I was checking my calendar.

I’m not sure what the unsolicited suggestion is here. Perhaps it is: keep in mind what small fiddly tasks you might be able to do as a way to ease into more challenging tasks on the same project.

Priorities in research doings (or: knitr, mammalogy labs, and motivation)

Author: Brianna

One of the nicest things about graduate school, for me, is the control over my schedule. I had that in undergrad too, but more constraints because of more classes. Also I was still riding horses almost every day, which cut out most evenings. Why is control over my schedule so great? Because I am obnoxious about my work habits and I think I can get better work out of myself when I follow my nose.

I drafted this post a few weeks ago in a fit of inspired work time. (I’m still just as excited about knitr, by the way. And the paper I mention is getting submitted in the next week or two, with full data and the code formatted all pleasantly thanks to knitr.)

You guys know the way I think about work habits all the time: I have detailed writing strategies, I enjoy settling into routines and then semi-frequently breaking them, I spend time thinking about nature of motivation. About the only thing that stays really constant is that I’m a morning person, so I don’t really do work past 7pm except in dire circumstances or…moments of pressing inspiration.

Which is to say: yesterday I was working on R code for a really neat project on horses from the Paisley Caves of Oregon, and as I was working I was pondering its eventual inclusion with the paper itself. So I was trying to be thorough, you know, including code to save the plots and commenting things nicely and such. And then I thought, what the hell, learning to use knitr and rmarkdown to make nice outputs has been on my to-do list for awhile, let’s learn it.

Which is more or less why I wound up working last night until about 8, when the grumbling of my stomach became too much to ignore. (You’ll note that the other half of Fossilosophy would snicker at this, as Kelsey sometimes doesn’t even warm up until around that time in the evening.)

Because I was having fun. So much fun. Do you guys REALIZE how cool knitr is??

Right, about priorities: yesterday I tasked myself with working on writing mammalogy labs. That is also a cool project that gets me really excited about science and teaching, because I get to design an entire semester’s worth of labs. And also I am feeling internal pressure to make forward progress on it because it has slipped down on the priorities list thanks to preparing two posters for SVP.

But I was really excited about knitr!

So you know what? I worked on my code and knitr. Because damned if I’m going to waste the kind of excitement that helps me learn important tools I’ll use in just about every research project ever, while also moving forward the project that is probably closest to submission of all my projects.

This is the glory of having few to no hard deadlines this semester, a luxury that I recognize is rare and thus will milk for all it is worth. I will still write all the mammalogy labs; a day or two will make zero difference. How silly it would have been to let the internal guilt meter decide what to work on when I was truly excited and motivated about something else that also offers me long-term research benefits.

Extra credit links:
A Beginner’s Tutorial for knitr
Knitr with R Markdown
Getting Started with R Markdown, knitr, and Rstudio 0.96
Drifting towards deadwood, or not: learning to use R (interesting thoughts on putting in the time to learn big new skills; same thought process I use to make myself put in the time to learn things like knitr)

What we are thinking about lately: Bayesian vs. frequentist approaches, R coding, and reading all the things

Authors: Brianna and Kelsey

What are we up to lately at Fossilosophy? Good question. Here’s what was on our minds last week.

Reading Habits

Guys, there are not very many things as satisfying as going on a paper-downloading spree for something related to your research. There is something to be said for deciding what you need to know, flailing around up to your eyeballs in the literature for awhile, and pulling something coherent out of the mess. Lately Brianna has done this for a few different areas, including the painfully general “(evolutionary) locomotor biomechanics and skeleton stuff!” and a much more specific hunt for statistical quirks in using discriminant analysis to classify fossils. Now, to read and/or skim those ~70 papers…

Kelsey, on the other hand, is probably printing about ten papers per week, and greatly enjoying that every single one of them is in color.

Data Analysis in R

Whenever it comes time to do some data analysis in R, you generally have three situations: 1) You have no idea at all where to begin. Time to start asking books, friends, and the internet, 2) You know all the things you want to do but don’t have all the proper tools, or 3) You know what you want to do and are perfectly capable of writing efficient, elegant code to do so.
If you answered situation 3, that’s very nice. (We haven’t run into that very often yet.) Situation1 happens more often than we would like to admit, but right now we have been thinking about situation 2. You can take one of two general approaches: using the tools you have to get the job done, and teaching yourself new tools. The first choice means doing many things stuff manually, repeating lots of code, resorting to programs like JMP for bits and pieces because it’s so much faster, and just doing things in whatever way you can to get the job done. Sometimes this is what you need, especially if you’re crunched for time because of a deadline. It’s the penny-wise and pound-foolish approach, if you will.

Lately the ladies of Fossilosophy have been aiming for the seond approach, where you go teach yourself the tools you need to do things the right way. It takes way longer and it’s frustrating, but it also builds character (and coding skills). Three cheers for doing things the hard, but proper, way.

Kelsey likes to think of coding as a set of nested dolls or a machine where every part has to be hand-made. Every “gear” is tested as you go, which generally cuts down on debugging later on. The overall operation (say, the regression part of a regression analysis) may be the very last bit of surrounding code you add, after all the parts are moving.

Also, we are fond of giving objects amusing names. This will help you remember all the variables and make readers of your shiny published code smile.

If anyone is interested in a very friendly, straightforward introduction to R book, we liked Getting Started with R: An introduction for biologists, by Andrew Beckerman and Owen Petchey. It is written with great clarity, has good examples to work through, and has just enough tongue-in-cheek humor to make the reading fun.

Bayesian vs. frequentist approaches

It’s a giant can of worms. Make that wormholes…a can of wormholes that, once opened, can send you huddling up under the table faster than trying to wrap your head around what exactly a genus or species is. Though Brianna has enough statistical background to understand the broad ideas behind what’s going on in the Bayesian/frequentist/pragmatist arguments, the whole debate is a little overwhelming and difficult to wrap her head around. (Latest round of mental crisis sparked by an older Oikos post on the matter. Good links and comment section there, too.)

More on this later, after we straighten out our thoughts a little more.

Other fleeting things occupying our attention: how awesome flow charts are, how difficult it is to estimate how long some academic/research task will take to complete, and how great it is being able to bounce ideas off of fellow grad students.