R for the Rest of Us

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 people who does generative art in R. She talks about why she likes making generative art in R and how making generative art has helped her improve her R skills in other areas.

Important resources mentioned:
Connect with Meghan on LinkedIn, X, and Mastodon

Subscribe to our newsletter: https://rfortherestofus.com/newsletter

To view all of our courses, go to https://rfortherestofus.com/

What is R for the Rest of Us?

You may think of R as a tool for complex statistical analysis, but it's much more than that. From data visualization to efficient reporting, to improving your workflow, R can do it all. On this podcast, I talk with people about how they use R in unique and creative ways.

David Keyes:

Hi. I'm David Keyes, and I run R for the Rest of Us. You may think of r as a tool for complex statistical analysis, but it's much more than that. From data visualization to efficient reporting to improving your workflow, R can do it all. On this podcast, I talk with people about how they use R in unique and creative ways.

David Keyes:

Well, I'm delighted to be joined today by Meghan Harris. 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, Meghan likes to do generative art with r. It's a lot of r's. Wow.

David Keyes:

And so I'm excited to, talk with you today, Meghan, about the generative art piece of your work. So welcome.

Meghan Harris:

Thank you so much, David.

David Keyes:

So before we get into that, maybe we can kind of start out, and you've actually been on the podcast before, so I'll 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?

Meghan Harris:

Yes. So I got into R technically with the first job I actually had outside of grad school. And, unfortunately for us, grad schoolers, we had to learn SAS, which is not hard. No offense to any SAS lovers. But when I was in my first job outside of grad school, there was opportunities to use R.

Meghan Harris:

At that time, I was evaluating studies and stuff like that, and it got to a point where I really could not put down the idea of learning art, so I just kinda gridded through it and kinda taught myself. 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 in, like, my day to day work. Until I eventually, you know, left that job, that Gexley Jobs with the actual word data in the title, and and now all of a sudden, I'm a data scientist here.

David Keyes:

Yeah. And because you've had a few job I mean, the evaluation job, if I'm remembering correctly, is that that was at the University of Buffalo? Is that

Meghan Harris:

no. That was at CCNY. 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, I saw you do a presentation or a talk on, our markdown at the 2019, I think, the AEA, American Evaluation Association Conference. I think that was in Minneapolis, right, before before the world closed down.

David Keyes:

Yeah. Yeah.

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.

Meghan Harris:

I was working as a data specialist, working with, like, a lot of mapping stuff, GIS, and, like, opioid overdose data. That's right. Yeah. And now I'm here at Memorial Sloan Kettering Prostate Cancer Data stuff as well. So not a smooth path, but that's

David Keyes:

I mean, that's 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 our and so I think in that sense, while it might not feel smooth, I think it's not not atypical in many ways.

Meghan Harris:

Alright. Absolutely.

David Keyes:

Yes. I'd love 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 what your your daily uses of r looks like?

Meghan Harris:

So I think so far because I I believe I'll be coming up with 2 years, actually, in the next month or so. And I am primarily working on a study called DORA. But, basically, we at St. A. Sciences at work at the Cross State Cancer Medicine, sort of a lot of our work is just supporting the clinical trial here.

Meghan Harris:

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, for, like, safety and efficacy before it goes to the FDA and 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. 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.

Meghan Harris:

Like, we had, like, a major overhaul in, 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 billable is. And a lot of that work is super tedious. So there is a lot of data validation and just, yeah, making sure things are in the right space. Like, it it's a lot. But then I also do package development as well.

Meghan Harris:

Very lightly, we have our own internal packages that we use. 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 on 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, visualizations a lot, which is, like, surprising to me given, like, how I started and, like, where I thought I would land. But it's fine.

David Keyes:

Yeah. I I, you know, saw a lot of your work, you know, several years ago, thinking about, like, the tidy Tuesday data visualization pieces that you put together. And then I saw you kind of start to get interested, in generative art. So can you talk about the process of how you got into that in the first place?

Meghan Harris:

Yes. So I got into that because of I'm not I'm not calling it x. Okay? It's Twitter. I got into it on Twitter.

Meghan Harris:

Back when Twitter was great and everybody in our community was on it, I had came across, I don't I don't know if you're familiar with, Ejimaka Ejimaka Fomagale. She just got married. She was the first person that, like, I credit to, like like, turning me on to gender to bar, because I had no idea what it was. 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.

Meghan Harris:

And 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. 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, where she explained how to do, what, subdivision of rectangles.

Meghan Harris:

Pretty much how to make a whole bunch of rectangles from 1 rectangle. And when I read the blog post, I was just like, my my main takeaway was that I'm not smart enough for this. So that was my main takeaway. My 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 I'm like, how does this work? So one of the more, like, pivotal turning points about the school 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 her.

Meghan Harris:

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 just went off. I was just like, this is how you do it.

Meghan Harris:

Okay. So that's literally, like, what happened. I just connected with the right person on Twitter, and they were so gracious of us to take time to share a blog post. And, like, that blog post was, like, the seed. And that was it.

Meghan Harris:

The rest is the seed, honestly.

David Keyes:

That's great. And if someone has never, you know, seen or heard of generative art, how how do you describe it? What what makes art generative?

Meghan Harris:

Yeah. So I think people will disagree with my definition. But my definition is that it's 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 art. So to me, that could be coding in R or Python or whatever JavaScript, whatever language.

Meghan Harris:

That could be using, like, a click and drag interface like Canva because I'm using a computer to do it. And that could also obviously be giving an, 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 about about art. But I really don't get into the specifics of that.

Meghan Harris:

I mean, I think it's cool and awesome, but I also feel like there's, like, these ethical considerations as well for the AIR. 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 the Yeah. Part of our data.

David Keyes:

And we'll we'll get it I mean, in a little bit, we'll we'll have you kinda demonstrate some examples. But it seems like Yeah. You know, what you were saying before is you talked about Ijemaka'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.

David Keyes:

Right? You're working in R. So that that seems like a unique feature as well.

Meghan Harris:

Yeah. Absolutely. I think I made that distinction as well, when I presented on this last year. Because 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 and drawn out sentences to create.

Meghan Harris:

Right. And it's just like, no. Like, you're literally, like, in here, like, man. Like Yeah. Yeah.

Meghan Harris:

Yeah. Wrangling data. You are like, you know and I think, 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.

Meghan Harris:

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 GT plot 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 writers.

David Keyes:

Yeah. Well, I'm curious. I mean, I 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 you rarely actually do DataViz. I'm I'm guessing that part of the appeal for you is the fact that you can, you know, do get kind of get your your your data viz juices flowing.

David Keyes:

Yeah. Is is that right? And are there other things about it that that makes it appealing to you?

Meghan Harris:

Yeah. So, I mean, honestly, like, I'm getting to the point in my career where it's just like I I wanna spend as less time as possible in front of a computer, honestly. So I don't really have the data that's itch I usually used to get anymore. I don't know. Maybe that's a product of being a parent now and just being tired all the time.

Meghan Harris:

I know. But, what it was was that I loved that I could use r without anything being wrong, per se. 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 GM for, like, a time series when it really should just be GM wide. 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.

Meghan Harris:

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, and I think that's what I love the most about it. I mean, that's kinda why, I'm jumping the gun.

Meghan Harris:

I know. That's kinda why, like, I feel the way that I do about statistics. Okay. Because I I feel like there is way too much subjectiveness in, statistics. So although, like, I had taken all these stats classes, and, like, I'm a trained epidemiologist.

Meghan Harris:

Like, that was, like, what my degree is in. I don't like the fact that I can spend so much time making a model, a SaaS model, and then so I was just like, that's wrong. Mhmm. Like, if I spend all my time making my art, you can't tell me it's wrong.

David Keyes:

Yeah. That's interesting.

Meghan Harris:

So it was yeah. So it's just really freeing to, like that was, like, the main thing for me. I mean, I I feel like it's fun and it's therapeutic. It used to be, like, when 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, 3 o'clock in the morning, whatever.

David Keyes:

Wow.

Meghan Harris:

I don't have time to do that now, though. But future Well But it was therapeutic.

David Keyes:

Yeah. And you did tell me, speaking of not much time and still using art, you did tell me that you used, 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?

Meghan Harris:

So, when I first had my son, son, I had my son in November 2022. And, 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.

Meghan Harris:

Right? But what me and my husband used to do when, my son was younger, when he was an infant, he would actually do shifts. So I'd be up for 12 hours with my son while he's sleeping or whenever, then my husband would take over for 12 hours. So, I was able to do a lot because, you know, that's that's what they're if they sleep, like, on 2 hours then. You know?

David Keyes:

Right. Right.

Meghan Harris:

So, I was able to do that. There'd be times where, you know, with postpartum and stuff, because I'm very open and active about, you know, whatever. I already have a mental health history and all that stuff. So, like, when I was postpartum, like, 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.

Meghan Harris:

Like, I just really need this this hour or 2 to, like, crank out this this art. Like, I think also I did, 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. But every January, there's also, like, a daily, like, generative art challenge, not just for our users, for anybody coding.

Meghan Harris:

So I remember doing stuff like that as well. And then I had to do some generative art because we me and 3 other co authors, we are actually in the middle of creating a textbook right now for creating generative 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 some art before I lose my mind in this house. So that's how it was possible.

David Keyes:

Yeah. That's interesting. It's the fact that it was kind of therapeutic for you in a way. That's fine. When I reached out to you about doing this interview, you told me your quote was, I absolutely hate math.

David Keyes:

I wanna 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?

Meghan Harris:

So the answer is it depends on what you wanna make. So, for me, I has to learn some type of math because I actually have an affinity for circles. Really love circles. As you can see, there's a huge circle that I created in art and got printed. Yeah.

Meghan Harris:

So, I had to learn how to translate, like, you know, geometric equations into parametric equations that could be put into g plot. And it sounds super complicated, but it's super not. Actually, the example of what we're gonna do today actually shows it, so I won't go too much into it right now. Okay. But that was basically what I needed to know.

Meghan Harris:

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 art. I think one of the hardest things I had to learn math wise was actually, more basic geometry. Like, kind of, like, a refresher geometry because 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.

Meghan Harris:

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. 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. 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.

Meghan Harris:

Better. But you don't you really don't need to know, like, so so so much math to do art because I I don't I don't like math, man.

David Keyes:

Yeah. Yeah. I mean, it seems like you kind of figure out, like, 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 Yep. As opposed to thinking, okay. 1st, I have to master, you know, every piece of geometry knowledge that I forgot from high school.

Meghan Harris:

Nope. Absolutely not. Use

David Keyes:

that. Yeah. Cool. Well, you're gonna show us, an example here of some generative art. Hey.

David Keyes:

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 wanna 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 the other work in art that you do.

David Keyes:

So can you talk a little bit about that? What in what ways did generative art help you with your your

Meghan Harris:

regular work? 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.

Meghan Harris:

It took 6 months. So that was 6 months of not needing 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 highest 6 months.

Meghan Harris:

So, I was really concerned about, like, opening up r one day and just, like, forgetting everything that I learned. Yeah. So that was, like, one of the motivations of, like, I gotta be doing something. But I also, it was a good tool for me to get over some mental blocks that I had. So, one of those blocks was actually iteration, like, doing things in lists, doing a lot of, like, iterative operations over and over and over again.

Meghan Harris:

And, 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 whether you are doing, repetition. But there's also nothing wrong with doing 4 loops and while loops and, like, making those control flows manually. You know, there's nothing wrong with that. Either way, like, the aspect of use of, like, creating art, 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 worked.

David Keyes:

Wow.

Meghan Harris:

But using, r for generative art helped me to kinda, like, get over that, like, block of, like because it was different for me personally where it's just like, okay. I understand the art I'm trying to make. 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?

Meghan Harris:

Mhmm. It was to the point when I was on maternity leave that one of my coworkers, like, so one of my coworkers used to be Daniel Solberg, who is known for his amazing packages will be times where, like, I just text them 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 x y z? And, it just kinda made me have a different reason for needing to do things.

Meghan Harris:

Right? So now after doing all of this stuff on maternity leave, I made my package while I was on maternity leave. Like, I had started that up, and, I just had so many reasons to, like, now start doing all these things and are that either I wasn't introduced to you 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 changed the motivation a little bit when it was something that, like, wasn't stressful because, like, this wasn't something I was reporting to somebody and, was for fun. It was like I'm I was the expert of what the output should be.

Meghan Harris:

So it was like, it was a little bit easier for me to be like, okay. Yeah. Yeah. Yeah. I need to make, like, multiple things of this, or I need to test this in my package.

Meghan Harris:

Like, it it made it just so that I was able to retain that information a little better.

David Keyes:

You know? Yeah. I mean, that's such a good example, like, the iteration example of, you know, obviously, iteration can apply in all sorts of work that you do. So the fact that you really learned it through doing generative art and then applied it other places is great.

Meghan Harris:

Yeah. That and package development too because 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, like, regardless of if it's art or not, it's just like, I am always making the same line of code to make this up to each button or whatever.

Meghan Harris:

You know? So it got to the phone. I'm just like, this could be a package. I could do a package.

David Keyes:

Right.

Meghan Harris:

And, you know, the package, I I wish I had more time. I probably from the next year, there'll probably be 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 doing that. I learned how to validate data and inputs to functions so that, like, they're working properly. I learned how to use the CLI package to make pretty package error messages in some way.

Meghan Harris:

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 gonna break.

David Keyes:

It. Yeah. Yeah.

Meghan Harris:

Because I've seen this. So that really was the the the the benefit. It was like I was just getting exposed so much. You know? It's like I came back from maternity leave, and I felt like I was smarter from when I was hired.

Meghan Harris:

Like, it was amazing.

David Keyes:

That's great. So if someone wants to get started with generative art, are where would you recommend they go to learn more?

Meghan Harris:

So I'm gonna say either my edge of the DataArt blog post because it is unique and that it is really, like, structured for, like, a true beginner. But there is also a, art from code. That's the name of it. Art from code workshop that Daniel Navarro did for our studio comp, like, 2 or 3 years ago. Okay.

Meghan Harris:

That one is really good because she explains everything, and there is flushed out code for everything. So it's it's great for finish as well.

David Keyes:

Great. Well, we will include, the links to both of those in the show notes. Megan, thanks for joining us. It was really great to chat with you and see the the generative art that you do.

Meghan Harris:

Thank you so much, Dean. It was fun.

David Keyes:

That's it for today's episode. I hope you learned something new about how you can use r. Do you know anyone else who might be interested in this episode? Please share it with them. If you're interested in learning r, check out r for the rest of us.

David Keyes:

We've got courses to help you no matter whether you're just starting out with r or you've got years of experience. Do you work for an organization that needs help communicating effectively with We work We work with clients to make high quality data visualization, beautiful reports made entirely with r, interactive maps, and much, much more. And before we go, one last request. Do you know anyone who is using r in a unique and creative way? We're always looking for new guests for the r for the rest of us podcast.

David Keyes:

If you know someone who would be a good guest, please email me at david@rfortherestofus.com. Thanks for listening, and we'll see you next time.