Developing intuition about how to build analyses


Hey folks,

It’s been a couple of months since I sent out a newsletter. The truth is that I was out of ideas for code smells and didn’t really have anything to say. I’m going to try out a new series that I hope you’ll like.


My 19 year old son is very talented mechanically. If a piece of equipment stops working, he can come up with a series of possible diagnoses and methods to test them. He also knows the most likely and cheapest path to hone in on the solution. He has been known to fabricate parts to get things working again. My 14 year old daughter loves to knit and crochet. Recently, she’s been making potted plants and animals without looking at a plan. She tells me how she can see other things she’s made in each of the parts of the project. Then she has to figure out how to adjust them for her purpose and put them all together. I could tell you similar stories with my other kids’ eclectic interests and skills.

It occurred to me recently that this is a lot like looking at a plot and mentally taking the plot apart in my mind to ask how the author might have made it. I think this is a skill that is critical not just to learning how to make plots, but to breaking free from the ruts that scientists get into when they make the same type of plot over and over. My pet peeve is people asking me how to make a specific plot from a specific set of data. That is a very transactional question. It’s like needing to use a cook book to cook everything you eat. Cook books are great, but if you find yourself missing a critical ingredient or if something goes wrong, will you be able to adapt rather than starve?

My goal for you is to show you that you can take data in any format to make any of a number of figures. You can do this by taking elements from all of your past experiences to make something that is yours. In the coming weeks I’m going to use this newsletter to help you see how I think through deciphering how figures were made. Let me know what you think. I would love it if you could send me figures to use in future newsletters!

My question isn’t what do you like and what don’t you like about a figure. Rather, the question is, “How would you make a figure in R?” This is an exercise that you should be able to do with a pen and paper. Take a minute to look at the figure I share and try to answer the question at a high level. Don’t worry about the exact function names, packages, or arguments.

Let’s try it out. Here’s a random figure that I found in the most recent issue of the journal mSphere. It’s Figure 1A from the paper, “Exploring novel microbial metabolites and drugs for inhibiting Clostridioides difficile” by Ahmed Abouelkhair and Mohamed Seleem.

The figure shows the level of inhibition of bacterial growth by 527 compounds; 63 of the compounds were deemed “strong hits” because they inhibited growth by at least 90%.

Imagine what the data frame looks like, what are the columns? What types of data are in each column? What are the parts of the figure? What functions would you use to generate each part? What happens if there are multiple options? Even if you don’t remember what the function is named, write what it needs to do. What did they have to turn “on” or “off” to generate the figure? Write the answer out in sentences with some prediction of what you think will happen and the tradeoffs you might encounter. Don’t worry about writing code that will run. That’s the next step when you have real data.

Next week, I’ll share my response with you. I would love it if you were to send me one of your favorite figures! Then in a future newsletter I’ll share with others how I would break it down.

Workshops

I'm pleased to be able to offer you one of three recent workshops! With each you'll get access to 18 hours of video content, my code, and other materials. Click the buttons below to learn more

In case you missed it…

Here are some videos that I published this week that relate to previous content from these newsletters. Enjoy!

Finally, if you would like to support the Riffomonas project financially, please consider becoming a patron through Patreon! There are multiple tiers and fun gifts for each. By no means do I expect people to become patrons, but if you need to be asked, there you go :)

I’ll talk to you more next week!

Pat

Riffomonas Professional Development

Read more from Riffomonas Professional Development

In case you missed it, I have nine kids ranging in age from 23 to 7 that my wife homeschools. They’re a riot. Each of them has to find a way to be different from all of the others. This makes for some real characters. Let me introduce you to Peter. This week, Peter, who is 11, has been working on a times table. You may remember these from when you were a kid. Say you want to know what 7 times 8 is (this was always my hardest “times” to remember). You take your finger down the rows to the...

Hey folks, I’m really enjoying sharing with you my 30,000 foot view of how I would go about making figures that I find in the “wild”. Following up on these emails with a couple of related YouTube videos has been a lot of fun for me. Of course if you find any figures you like, send them my way - I love seeing what interests you all. I was reminded recently though that not everyone feels enough confidence with their R and tidyverse skills to keep up. Sorry! Towards the bottom of this email I...

Hey folks, We’re still slogging our way through Thanksgiving leftovers. As time passes from last Thursday, there’s a fine line between setting a good example about not wasting food and setting a bad example by getting every food poisoning! Speaking of eating, our teeth are pretty important, don’t you think? In the US, Trump’s expected head for the Department of Health and Human Services has a number of interesting views about health. One example is that its a bad idea to spike our drinking...