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 is a livestream 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

Hey folks! As I’m writing this newsletter the US government is in shutdown mode with no clear signs that things will get going anytime soon. I’ll withhold my own political take except to say that my family has been running without an official budget for about 25 years. I don’t recommend it, but we know basically how much money goes to our mortgage, insurance, groceries, charities, etc. and how much money we generally have left over. Somehow we still are able to spend money on living a pretty...

Hey folks! This week I have a figure for you from the New York Times based on a poll they did with Siena that describes Americans’ sentiments concerning Israel’s actions in their war with Gaza. What does it say to me? This plot is saying that more Americans think that Israel is intentionally killing civilians than they did in December 2023. The change in percentage of people in the other categories seems to decrease accordingly. What do you like? I love slope plots! I think they’re a great...

Hey folks, This week I have an interesting figure for you from the Financial Times from an e-mail newsletter they distribute each week describing some visualization related to climate change. Before reading further, go ahead and spend a few minutes with the image. What does it say to you? What do you like? What don’t you like about it? How do you think you would go about making it in R? I’d encourage you to write down any of your answers to these questions before reading what I have to say....