
Kelly Bodwin | Course Material Creation in the R Ecosystem | RStudio (2020)
In this talk, I will introduce a suite of three packages designed to aid course material creation in R: {demoR} for displaying code in knitted R Markdown with custom highlighting and formatting; {shindig} for shortcuts to creating simple educational Shiny apps; and {curricular} for easy creation of syllabi, homework exercises, exams, etc. Together, we will explore how these new tools - in conjunction with other existing resources - have been used to create a clean and consistent ecosystem for my R-based Introductory Statistics course. I will share some metrics on student outcomes, as well as my own experiences with the advantages and challenges in building the course. A 5-minute presentation in our Lightning Talks series
image: thumbnail.jpg
Transcript#
This transcript was generated automatically and may contain errors.
All right. Hello. I'm Kelly. I'm a professor at Cal Poly. It's about three and a half hours south of here. And I'm going to tell you about some stuff. We are building five minutes. So welcome to my infomercial. Here we go. So here is the thesis by which my collaborator Hunter and I started this project. Things are hard. And things are extra hard for teachers have no time for things and no resources sometimes for things like personal development and RStudio conferences. So we were like, how can we use R to make it easier for the other people in our field?
So we have two packages that are in infancy. And these two packages I'm going to give you the shortest possible sneak preview. And then I'll tell you more about the one that's not in infancy. So here's a thing that's hard if you are a basic R user. And I mean basic probably beyond anyone at this conference. Many of our collaborators or our colleagues, they use R, they know it, by which I mean they can read in data and run a linear model. Not much else. And they're very excited about Shiny, but the whole idea of Shiny is very intimidating. So we're working on a package that the idea is, can we boil Shiny down to something accessible by people at this very basic level? So the basic idea is to have some kind of pipeline maybe that creates the app for you that writes the skeleton code. Again, we have some of this running, but it's not public yet. And we're very open to other ideas as well, thinking about ways to make it easier.
Templar and course material templates
The second thing that's hard is updating course materials. Every single year you have to change all the little details in your syllabus, even if the structure of it didn't change much. So package number two is called Templar for templates. And the idea is templating is really cool in RStudio and R Markdown. So one thing is there's package templates, so you could auto-generate all the subfolders of your course file, and it would fill in the course name in the right places. And then it would populate those folders then with R Markdown template files that use YAML to kind of automate fillers. So this is a syllabus example. Made it as big as I could and get everything in there, but the idea is the information that changes quarter to quarter, year to year, you would just change in the YAML. Everything else you could leave alone, and maybe it's even going to write tables and stuff automatically for you.
Introducing Flare
All right. So that's your sneak preview. But what I am here to mostly tell you about is Flare. Flare is a package that I'm very excited about. So this is something that maybe applies to everyone in this room. Formatting source code for presentations. I've seen a lot of presentations today. People are showing their source code. Sometimes what you want to do is things like highlight the important parts of your source code, right? But this is very frustrating sometimes. There's several problems with it. One is just the annoyance of what most people do. What I used to do is copy paste the R code into like PowerPoint and manually highlight things or what have you. Perhaps more importantly to this community, it's not reproducible. I don't know if you have done this. I have done this in class where I decide to tweak something and I forget to tweak it in the PowerPoint or whatever, and then my students are seeing code that doesn't match the graph. That's not great.
it's not reproducible. I don't know if you have done this. I have done this in class where I decide to tweak something and I forget to tweak it in the PowerPoint or whatever, and then my students are seeing code that doesn't match the graph. That's not great.
And so we like to introduce Flare because you are adding kind of meaningless decoration. It does not change how the code runs and it does not change the internal, I don't know, value of the code.
And so how it works, very briefly, you have your code chunk. Nothing in this code chunk is new except that it's very important that you give it a name and important probably that you turn off include unless you want it to be duplicated. And so we all love Iris. I only have five minutes. I can't tell you about new data sets. So suppose this is my code chunk. That's what it looks like. Step two is you call this decorate function that kind of preps that code chunk to be flared. And then all you have to do is add the flare that you want to this code chunk.
So there's a whole suite of Flare functions. The basic one is just like directly Flare a string. And then the other ones, we've got some shortcuts for like highlighting functions and stuff. So you might end up with something like this if you're trying to teach piping. Here's the functions that you're piping to. There's my pipes. Then we learn exciting new things about flowers.
Questions and what's next
So that's it. That's all it takes. There's a lot more that I would love to tell you about it, but that's the main deal. So I just, because there's no questions, I want to answer some things that you might want to know.
Does it work in all the like R Markdown spin-offs? Mostly yes. These are in share engine. Obviously I used Flare to flare my flare. But there's kind of a little complication where we sort of have to hard code the way code gets formatted. That's not the same for every doc type. So all you got to do is tell me what doc type you want, and I can easily add that in. But I have to know about that doc type to make it work.
What happens when you, so this is for knitting, right? We want the knitted code to look good. What happens when you just run it actively? First of all, any code that you have, if you've chosen to leave Evaluate on, it does run, so you can like reference objects. And it previews how it's going to flare in your viewer pane, so you can check that without knitting. LaTeX is the next order of business. Crayon was going to be on two months ago, and then I woke up at 3 a.m. with a whole plan of how to rebuild everything better. So imminently is the hope on Crayon. It's just about there.
And that's all I have to say. Hex stickers. Sorry. Hex stickers are on the chair at the end if you want them.
