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
man floating holding on orange stick white people watching on the street

Hey folks, I have long since given up trying to anticipate what types of videos will resonate with people on YouTube. One of my most popular videos shows people how to make stacked bar plots. Throughout it, I tell people that these are a horrible way to visualize data. It’s my third most viewed video. I thought a video on slope plots would be popular. Nope. People panned last week’s episode. But Venn diagrams - holy cats! People are really geeking out about this week’s episodes on Venn...

Hey folks, I’m really grateful for the people who have emailed me recently to thank me for making the recreation and makeover videos. I’ve been excited to see the types of figures some of you are trying to make. It’s really been a great part of this work for me. Thank you! Eric Hill is a loyal Riffomonas Channel viewer who recently sent me an animation he made using the p5.js platform. The animation shows his son’s performance relative to other runners in the prestigious Nike Cross Nationals...

Hey folks, One of the benefits of sending out these newsletters and making my YouTube videos is that I get a ton of practice. I can’t emphasize how much practice has paid off in learning to use dplyr, ggplot2, and other packages. Reproducing published figures has really helped me to dive into parts of ggplot2 that I wouldn’t normally use because I make plots that use the features of ggplot2 that I know. By expanding my knowledge of ggplot2, I’m finding that the plots I make from scratch are...