R for the Rest of Us Podcast Episode 17: Meghan Harris
In this episode, I speak with Meghan Harris, a data scientist at the Prostate Cancer Trials Consortium at the Memorial Sloan Kettering Cancer Center. Meghan is one of the special people who do generative art in R. She talks about why she likes making generative art in R and how it has helped her improve her R skills in other areas.
Listen to the Audio Version
Watch the Video Version
You can also watch the conversation on YouTube. In the video version, Meghan gives a walkthrough of how to make generative art in R
Important resources mentioned:
A talk Meghan did in September 2023 making a case for generative art
Ijemaka's blog Meghan referenced that help her learn/do generative art with R
Connect with Meghan on LinkedIn (Meghan Harris, MPH), X, and Mastodon
Learn More
If you want to receive emails to help you on your R Journey, sign up for the R for the Rest of Us newsletter.
If you're ready to learn R, check out our courses.
Transcript
[00:00:00] David Keyes: Well, I'm delighted to be joined today by Megan Harris. Uh, Megan is a data scientist at the Prostate Cancer Trials Consortium at the Memorial Sloan Kettering Cancer Center, where she uses R for all of her daily data programming automation tasks, to support prostate cancer research.
On the side, Megan likes to do generative art with R. It's a lot of R's, um, and so I'm excited to, uh, talk with you today, Megan, about the generative art piece of your work. So welcome!
[00:00:58] Meghan Harris: Thank you so much, David, for having me.
[00:01:01] David Keyes: Um, so before we get into that, maybe we can kind of start out, um, and you've actually been on the podcast before, so we'll put a link to the episode that you were in before, but can you just give us kind of a brief overview of how you originally got into R?
[00:01:16] Meghan Harris: Yes. So I got into R technically with first job I actually had outside of grad school. And, um, unfortunately for us grad schoolers, had to learn SAS, um, which not R. No offense to any SAS lovers. But when I was in my first job outside of grad school, there was opportunities to use R. At that time, I was evaluating. And it got to a point where I really could not put down the idea of learning R. So I just kind of gridded through it and kind of taught myself. Um, and then I swear it was like a one day, it was like a light bulb went off and I was like, Oh, I get it now.
And I just started slowly incorporate using R and like my day to day work. Um, until I eventually, you know, left that job, got different jobs with the actual word data and the title and. Now all of a sudden I'm a data scientist here,
[00:02:16] David Keyes: Yeah, and because you've had a few jobs, I mean the evaluation job, if I'm remembering correctly, that was at the University of Buffalo, is that?
[00:02:24] Meghan Harris: Um, no, that wasn't CCY. And then while I was at CCNY, what was funny, because I always say this story too, I don't know if you remember, David, but you were actually one of the people that, inspired me to kind of like, get further into it because of, um, I saw you do a presentation or a talk on, uh, R Markdown at the 2019, I think, the AEA, American Evaluation Association conference.
I think that was in, uh, Minneapolis, right? Before, before the world closed down.
[00:02:54] David Keyes: Yeah, yeah.
[00:02:55] Meghan Harris: So when I saw you presenting on R Markdown, I was just like, oh my god, like I, it was like the, the confirmation that like I knew more than I thought I knew, because it was just like, I know what he's doing there. Like, I know that.
So when I got back from that conference, like I just had like all of this motivation to just like, learn, and whatever. And yeah, I did get the position at the University of Buffalo. I was working as a data specialist, working with like a lot of mapping stuff, GIS, and like opioid overdose data, stuff that.
Yeah, and now I'm here, at Memorial Sloan Kettering, prostate cancer data stuff as well.
So, Not a smooth path, but. 70?
[00:03:35] David Keyes: kind of the interesting thing about a lot of R users is people, have different backgrounds, come from different places, do really different things with R. And so I think in that sense, while it might not feel smooth, I think it's not atypical in many ways.
[00:03:49] Meghan Harris: Sure, absolutely. Yeah,
[00:03:52] David Keyes: to hear more about the work that you do with R.
I know obviously you can't talk about the, you know, specifics but just in general, can you give us a sense of, of what your, your daily use of R looks like?
[00:04:03] Meghan Harris: So I think so far, because I, I believe I'll be coming up with years, actually in the next month or so. And I am primarily working on a study called DORA, but basically, um, We as data scientists that work at the Prostate Cancer Clinical Trial Consortium, a lot of our work is just supporting the clinical trial data. So that looks different depending on what type of study you're on. So, DORA is a late phase trial, like, I think, like, the last step, um, for, like, safety and efficacy before it goes to the FDA and, like, all that good stuff.
So, a lot of that is actually what I feel like some people would call pretty boring work of, like, getting tables together, like, compiling reports. Um, I think some of the funner stuff I've been able to do or work on has been, Like literally rebuilding our like workflow pipelines. Like we had like a major, overhaul and like how we process our data, like just the steps of which, you know, it goes through us before it gets to a deliverable, whatever the deliverable is.
And a lot of that work is super tedious. So there is a lot of, data validation and just, you know, Yeah, making sure things are in the right space. Like, it's a lot. Um, but then I also do package development as well. Very lately, we have our own packages that use. Um, actually, it's hilarious given, like, you know, that I'm a generative artist.
Like, I really don't do a lot of data visualization in my job. I am definitely the go to person when, like, there's something that needs to be created. But, like, in my day to day, I don't really get to, to work with, um, visualizations a lot, which is Like, surprising to me given like how I started and like where I thought it would land, but fine.
[00:05:50] David Keyes: Yeah, I, I, you know, saw a lot of your work, you know, several years ago, um, thinking about like the Tidy Tuesday data visualization pieces that you put together, um, and then I saw you kind of start to get interested, um, in generative art. So can you talk about, the process of how you got into that in the first place?
[00:06:11] Meghan Harris: yes. So, I got into that because of, uh, I'm not, I'm not calling it X. Okay. It's Twitter. I got into it on Twitter back when Twitter was great and everybody in our community was on it. Um, I had came across, um, I don't, I don't know if you're familiar with, uh, aka aka, she just got married. Um, she was. the first person that like, I credit to like, like turning me on to Genitive Art, um, because I had no idea what it was.
Um, I had no idea what it was and I know that I had connected with her on Twitter and she would always post all these different like art pieces. And I never understood how. It's like, okay, I know people are using R to do this. I know they're using ggplot probably, but I don't understand how this works. Um, and it wasn't until one day she had posted only one blog.
If you go to her website, it is still only her single blog that is published, um, where she explained how to do a subdivision of rectangles. Pretty much how to make a whole bunch of rectangles from one rectangle. And when I read that blog post, I was just like, my main takeaway was that I'm not smart enough for this.
That was my main takeaway. Um, but what I did love about the blog post was that she showed. The code, because I was not understanding how, like, I just, it wasn't clear. I'm like, how does this work? So one of the more like pivotal turning points about this whole experience was that I had saw in the blog post.
She had literally just an example of a data frame and like the fact that she needed data to create something on a DG plot. And that was like literally all I needed to see. I just needed to see like, Oh, it's data. And then I started slowly like doing my own stuff, doing my own stuff, and then I was just like, oh my god, again, a light switch that just went off.
And I was just like, this is how you do it, okay. So that's literally like what happened. I just connected with the right person on Twitter, and they were so gracious enough to take time to share a blog post, and like that blog post was like the seed. And that was it. The rest is history, honestly.
[00:08:31] David Keyes: That's great. And if someone has never, you know, seen or heard of generative art, how do you describe it? What makes art generative?
[00:08:42] Meghan Harris: Yeah, so I think people will disagree with my definition, um, but my definition is that if Some component of a computer, some aspect of a computer, is being used to create the final output of the art. To me, that's generative So to me, that could be coding in R or Python or whatever, JavaScript, whatever language.
That could be using like a click and drag interface like Canva, because I'm using a computer to do it. Um, and that could also obviously be Giving an AI system a prompt to shoot something out. I don't know much about AI art. I haven't dabbled in it, only a tiny bit, when I was presenting on my talk last year. But I really don't get into the specifics of that. I mean, I think it's cool and awesome, but I also feel like there's like these ethical considerations well for the art. But that's generative art too, because you are using a computer or some medium to Like, produce a result for you. That's my opinion on what art is.
[00:09:55] David Keyes: And we'll get it. I mean, in a little bit, we'll have you kind of demonstrate some examples, but it seems like You know, what you were saying before is you talked about Ijimaka's example and how, you know, it was using data to generate the art. And it seems like in many ways, one of the pieces also that distinguishes the type of generative art that you do is you're working from data.
I mean, it makes sense, right? You're working in R, um, so that, that seems like a unique feature as well.
[00:10:24] Meghan Harris: Yeah, absolutely. I think I made that distinction um, when I presented on this last year. Cause I think people hear generative art and obviously because of the, the AI art boom, I think people just imagine people sitting down and like typing these long drawn out sentences to create art and it's just like, no, like you're literally like, In here like munching man like
[00:10:46] David Keyes: Yeah.
Yeah.
[00:10:49] Meghan Harris: are wrangling data you are like You know, and I think, um, what people don't understand is like how you get to that point of like, okay Well, how did you think of this thing? It's a really like as you'll see in like the demo like it's a really abstract way of thinking but I feel like that Once you see someone do it, it's kind of like, oh, like, I think that people feel like they're, they're boxed in. Like, there's these rules that you have to follow because a lot of people don't open ggplot unless, like, they have, like, real life data that they need to plot.
And there's rules about how you plot that data and, like, that doesn't exist with, you know, gender, is why I love.
[00:11:34] David Keyes: Yeah. Well, and I'm curious, I mean, I wanted to ask about, you know, why it appeals to you. One thing you talked about a few minutes ago was, in your current job, you rarely actually do data viz. I'm guessing that part of the appeal for you is the fact that you can, you know, do, kind of get your data viz juices flowing.
Um, Is that right? And are other things about it that makes it appealing to you?
[00:12:01] Meghan Harris: Yeah, so, I mean. Honestly, like I'm getting to the point in my career where it's just like, I want to spend as less time as possible in front of a computer, honestly. So I don't really have the data viz itch I usually used to get anymore. I don't know. Maybe that's just a product of being a parent now and just being tired all the time.
I don't know. But, um, what it was was that I loved that I could use R without anything being wrong So like, when you are doing practical work for work, like, you know, there's probably a right and a wrong way to do something. Like, I'm not gonna sit there and use, God, I don't know, some weird geom for like a time series when it really should just be geom line.
Like, I don't have a lot of creativity there of like how I create a time series or like how I do an analysis or whatever. And one of the more freeing things about being a generative artist is that there is no rules. It's only wrong if you don't get the image that you want. You know, there are no rules about how you create the data.
There are no rules about how You style it aesthetically, like there are no rules. Um, and I think that's what I love the most about it. I mean, that's kind of why, uh, I'm jumping the gun. I know. That's kind of why, like, I feel the way that I do about statistics.
Because I, I feel like there is way too much subjectiveness. in, uh, statistics. So, although, like, I had taken all these SAS classes and, like, I'm a trained epidemiologist, like, that like, what my degree is in, um, I don't like the fact that I can spend so much time making a model, a SAS model, and then, so, it's just, like, that's wrong.
[00:13:45] David Keyes: Mm.
[00:13:46] Meghan Harris: if I spend all my time making my art, you can't tell me it's wrong.
[00:13:50] David Keyes: Yeah. That's interesting.
[00:13:52] Meghan Harris: it was, yeah, it was just really freeing to, like, that was, like, the main thing for me. I mean, I feel like it's fun and it's therapeutic. It used to be, like, um, And I would just get upset with life. Like I literally would open my computer and like go to R and just start making art like three o'clock in the morning, whatever.
Um, I don't have time to do that now though, but,
[00:14:15] David Keyes: Well,
[00:14:16] Meghan Harris: but it was, was therapeutic.
Yeah, and you did tell me, speaking of not much time and still using R, you did tell me that you used, um, or you did generative art while on maternity leave. How is that possible and what, what, what did that look like? Were you doing it while your son was napping?
So, uh, when I first had my son, I had my son in November of 2022. And, um, first off, it was only possible because of my wonderful husband. Okay, let's just get that straight. It's because I had a support system, right? Um, but what me and my husband used to do when my son was younger, when he was an infant, we would actually do shifts.
So I'd be up for 12 hours with my son while he's sleeping or whatever, and then my husband would take over for the 12 hours. So, um, I was able to do a lot because, you know, that's, that's when they're easy. If they sleep like on two hours schedule, you know,
[00:15:10] David Keyes: Right, right. Yeah,
[00:15:14] Meghan Harris: be times where You know, with postpartum and stuff, because I'm very open and active about, you know, whatever.
I already have mental health history and all that stuff. So like, when I was postpartum, like, mmm, this is gonna be fun. So there would be times where me and my husband would work out times, because I'm just like, okay, like, I just really need This, this hour or two to like crank out this, this art, like, um, I think also I did, uh, I think the January challenge that used to be super popular on Twitter.
I don't know if it's still super popular now. I attempted to do it this year, but I was, I was hospitalized this year in January, so I couldn't do it. Um, but every January there's also like a daily like generative art challenge, not just for our users, for anybody coding. Um, so I remember doing stuff like that as well, and then I had to do some genitive art because we, me and three other co authors, we are actually in the middle of creating a textbook right now for creating genitive art for the R programming language. So that was going on as well. So I had like a little tiny bit of like, Oh, I have like an obligation to make some art, but then also like, I really just need to make before I lose my mind in this house. So that's how it was possible.
[00:16:36] David Keyes: that's interesting. It's the fact that it was kind of therapeutic for you in a way.
[00:16:42] Meghan Harris: It was fun.
[00:16:43] David Keyes: When I reached out to you about doing this interview, your quote was, I absolutely hate math. Uh, I want to know how you can hate math and make generative art.
Or in other words, like how much math do you need to know in order to successfully make generative art?
[00:16:59] Meghan Harris: So the answer is, it depends on what you want to make. So, um, for me, I unfortunately had to learn some type of math because I actually have an affinity for circles. really love circles. Um, as you can see, there's a huge circle that I created in honor in God's presence. Yeah. So, um, I had to learn how to. Translate, like, you know, geometric equations into parametric equations that can be put into gplot. And it sounds super complicated, but it's super not. Actually, the example of what we're going to do today actually shows it, so I won't go too much into it right now. Um, but that was basically what I needed to know.
So there are some things that, like, I do want to kind of like learn and get a little deeper in, but that does not impede on my ability to, to make my. I think one of the hardest things I had to learn math wise was actually, um, more basic geometry, like kind of like a refresher geometry. Cause there was a point where like, I really wanted to learn how to pack circles.
So like have a whole bunch of circles and none of them overlapping. And all that is, is literally just like distance formulas, like really basic geometry. But it took me a really long time to figure out because I'm not that smart when it comes to math. So I guess to answer the question for me personally, I just needed the lower level, basic understanding of geometry.
And then like the hardest part was learning how to translate that into code. Um, but for some people, like It might be that you don't need that. You just need to like, understand that relationship between the data you're creating and the visuals you want. Um, for some people that do like super like ridiculous stuff, like, I think the people who do super ridiculous stuff, like, like Danielle Navarro, like she's got degrees in math and like, that makes sense, but you don't, you really don't need to know like so, so, so much math to do. I don't, I don't like math, man.
[00:19:06] David Keyes: Yeah. Um, yeah, I mean, it seems like you kind of figure out like, well, what is the thing that I want to do? And then what is the math that I need to know in order to be able to do that thing? Um, as opposed to thinking, okay, first I have to master, you know, every piece of geometry knowledge that I forgot from high Nope, and, absolutely use that.
Yeah. Um, cool. Well, you're going to show us, uh, an example here of some generative art.
Hey, David here. Just wanted to let you know that at this point in the conversation, we switched to a screencast. Now obviously, showing code doesn't work very well in an audio podcast, so if you want to see the rest of this conversation, check out the video version of this podcast on YouTube. You can find a link to that in the show notes.
you have said that doing generative art helped you with your day job, helped you with the other work in R that you do.
So can you talk a little bit about that? What, in what ways did generative art help you with your,
[00:20:11] Meghan Harris: Absolutely. Absolutely. So doing generative art. Especially like while I was on maternity leave, obviously it helped to keep my brain active because I think one of the things I was scared about because my maternity leave was like exceptionally long. I took six months. Um, so that was six months of not Meeting to be coding.
Like I didn't have to code, like I didn't have to open up my computer. I literally had my work laptop, like locked away, like for the entire six months. So, um, I was really concerned about like opening up R1 day and just like forgetting everything that I learned.
[00:20:47] David Keyes: Yeah.
[00:20:48] Meghan Harris: So that was like one of the motivations of like, I gotta be doing something.
Um, but I also, um, it was a good tool for me to get over some mental blocks that I had. So, um, one of those blocks was actually iteration, um, like doing things in lists, doing a lot of, uh, like iterative operations over and over and over again. Like the per package in the tidyverse, if you're familiar, like that's like the, in my opinion, like the S tier package to use when you are doing repetition, but there's also nothing wrong with doing for loops and while loops and like making control flows manually, you know.
There's nothing wrong that. Either way, like the aspect of ease of like creating You know, they got to a point where like, I wanted to do a lot of things over and over and over. Like there was a point where like I probably would have made all of those data points that we just saw manually because I didn't understand how iteration works.
[00:21:50] David Keyes: Wow.
[00:21:51] Meghan Harris: But using, uh, R for generative art helped me to kind of like get over that like block of like, because it was different for me personally when it's just like, okay I understand the art I'm trying to make. Um, this is what I need to do. And so you get better with like resource gathering. You get better with like your Google searches of like, what are you trying to do?
Um, it was to the point when I was on maternity leave that one of my coworkers, like, uh, so one of my coworkers used to be Daniel Soberg, who is known for his amazing packages, like gt summary, and he works. in big pharma now in San Francisco. I'm sad. I miss you Daniel. Um, but there'll be times where like I just text him and be like, hey, I'm trying to do this thing.
I know, you know, nothing about art, but how do you think I can do XYZ? And, um, it just kind of made me have a different reason for needing to do things. Right. So now after doing all this stuff on maternity leave, uh, I made my package while I was on maternity leave. Like I had started that up. And, um, I just had so many reasons to like now start doing all these things in R that either I wasn't introduced to, or I just had like a mental block because I'm like, I don't know why I'm iterating through these things and like, blah, blah, blah.
It just. Change the motivation a little bit when it was something that like wasn't stressful because like wasn't something I was reporting to somebody and Was for fun and it was like I'm I was the expert of what the output should be So it was like it was a little bit easier for me to be like, okay Yeah, I need to make like multiple things of this or I need to test this in my package Like it made it just so that I was able to retain that information.
Okay, so
[00:23:38] David Keyes: Yeah. I mean, that's such a good example, like the iteration example of, you know, obviously iteration can apply things like in all sorts of work do. So the fact that you really learned it through doing generative art and then applied it to other places is great.
[00:23:52] Meghan Harris: Yeah, that and package development too.
[00:23:54] David Keyes: Hmm.
[00:23:55] Meghan Harris: Package development, I was just like, I, I'm not smart enough for this, you know, and then when it was just like, well, like, I, because I think people will notice that too, like, the more they're doing work, regardless of if it's art or not, it's just like, I am always making the same line of code to make this type of ggplot or whatever, you know, so it got to the point where I'm just like, this could be a package, I could do a package.
And You know, the package, I wish I had more time. I would probably from the next year, probably some huge updates to it when I have time and everything slows down, but regardless, I learned how to do unit testing while I was that. I learned how to validate data and inputs.
I learned how to use the CLI package to make pretty package error messages and stuff like that. So when I went back to maternity leave, it's just like, Oh, Hey, I can like maintain our packages here. I can go in and edit this and not be afraid. I'm going to break it
[00:24:54] David Keyes: Yeah.
[00:24:54] Meghan Harris: because I've seen this. So that really was the, the, the, the benefit was like, I was just getting exposed so much, you know, like I came back from maternity leave and I felt like I was smarter from when I was hired.
Like it was amazing.
[00:25:10] David Keyes: That's great so if someone wants to get started with generative art, where would you recommend they go to learn more? Yeah,
[00:25:20] Meghan Harris: So I'm going to say either my Intro to Data Art blog post, because it is unique in that it is really like, structured for like a true beginner. Um, but there is also a, um, uh, art from code. That's the name of it. Art from code workshop that Daniel Navarro did for RStudioConf like two or three years ago.
That one is really good because she explains everything and there's fleshed out code for everything. So it's, it's great for beginners as well.
[00:25:49] David Keyes: Great. Well, we will include the links to both of those in the show notes. Um, Megan, thanks for joining us. It was really great to chat with you and see the generative art that you do.
[00:26:00] Meghan Harris: Thank you so much, David. It's fun.
Sign up for the newsletter
Get blog posts like this delivered straight to your inbox.
You need to be signed-in to comment on this post. Login.