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

Hey folks, I hope you have enjoyed the current series of newsletters and videos recreating “data portraits” from the WEB DuBois collection of visuals he showed at the 1900 Paris Exhibition. You can find the entire collection of “data portraits” in a book assembled by Whitney Battle-Baptiste and Britt Rusert (here) or as a collection of plates through the Library of Congress (here). I’ve really appreciated the positive feedback! These figures are pretty different from what we do in modern data...

Hey folks, I hope you enjoyed thinking last week about how you would recreate Plate 12 from the WEB DuBois collection of visuals he showed at the 1900 Paris Exhibition using ggplot2 and related R tools. You can find the entire collection of “data portraits” in a book assembled by Whitney Battle-Baptiste and Britt Rusert (here) or as a collection of plates through the Library of Congress (here). I won’t reshare all the resources describing the collection, but do encourage you to check out last...

Hey folks, I’m at the end of a day after I pulled an all-nighter trying to hit a grant proposal deadline. I don’t recall ever doing this in college. I seem to pull an all-nighter every five years or so. I’m too old for this! Anyway, the proposal is in and now I’m ready to move on to fun things… like talking to you about visualizing data! A few years back Whitney Battle-Baptiste and Britt Rusert put together an amazing collection of visualizations by WEB DuBois that he presented at the 1900...