When RStudio crashes, it is not subtle about it. You get a picture of an old-timey bomb and the succinct, blunt message “R encountered a fatal error.” A couple hundred of my librarian friends and colleagues got to see it live during the demo I gave as part of a webinar I did for the Medical Library Association on R for librarians earlier today. At first, I thought the problem was minor. When I tried to read in my data, I got this error message:
Error in file(file, “rt”) : cannot open the connection
In addition: Warning message:
In file(file, “rt”) :
cannot open file ‘lib_data_example.csv’: No such file or directory
It’s a good example of R’s somewhat opaque and not-super-helpful error messages, but I’ve seen it before and it’s not a big deal. It just meant that R couldn’t find the file I’d asked for. Most of the time it’s because you’ve spelled the file name wrong, or you’ve capitalized something that should be lower case. I double checked the file name against the cheat sheet I’d printed out with all my code. Nope, the file name was correct. Another likely cause is that you’re in the wrong directory and you just need to set the working directory to where the file is located. I checked that too – my working directory was indeed set to where my file should have been. That was when RStudio crashed, though I’m still not sure exactly why that happened. I assume RStudio did it just to mess with me. 🙂
I’m sure a lot of presenters would be pretty alarmed at this point, but I was actually quite amused. People on Twitter seemed to notice:
— Patricia J. Devine (@pat_devine) October 5, 2016
— P. F. Anderson (@pfanderson) October 5, 2016
Having your live demo crash is not very entertaining in and of itself, but I found the situation rather amusing because I had considered whether I should do a live demo and decided to go with it because it seemed so low risk. What could go wrong? Sure, live demos are unpredictable. Websites go down, databases change their interface without warning (invariably they do this five minutes before your demo starts), software crashes, and so on. Still, the demo I was doing was really quite simple compared to a lot of the R I normally teach, and it involved using an interface I literally use almost every day. I’ve had plenty of presentations go awry in the past, but this was one that I really thought had almost 0% chance of going wrong. So when it all went wrong on the very first line of code, I couldn’t help but laugh. It’s the live demo curse! You can’t escape!
I’m sure most people who have spent any significant amount of doing live demos of technology have had the experience of seeing the whole thing blow up. I know a lot of librarians who avoid the whole thing by making slides with screen shots of what they would show and do sort of a mock demo. There’s nothing wrong with that, and I can understand the inclination to remove the uncertainty of the live demo from the equation. But despite their being fraught with potential issues, I’m still in favor of live demos – and in a sense, I feel this way exactly because of their unpredicability.
For one thing, it’s helpful for learners to see how an experienced user thinks through the process of troubleshooting when something goes wrong. It’s just a fact that stuff doesn’t always work perfectly in real life. If the people I’m teaching are ever actually going to use the tools I’m demonstrating, eventually they’re going to run into some problems. They’re more likely to be able to solve those problems if they’ve had a chance to see someone work through whatever issues arise. This is true for many different types of technologies and information resources, but especially so with programming languages. Learning to troubleshoot is itself an essential skill in programming, and what better way to learn than to see it in action?
Secondly, for brand new users of a technology, watching an instructor give a flawless and apparently effortless demonstration can actually make mastery feel out of reach for them. In reality, a lot of time and effort likely went into developing that demo, trying out lots of different approaches, seeing what works well and what doesn’t, and arriving at the “perfect” final demo. I’m certainly not suggesting that instructors should do freewheeling demos with no prior planning whatsoever, but I am in favor of an approach that acknowledges that things don’t always go right the first time. When I learned R, I would watch tutorials by these incredibly smart and talented instructors and think, oh my gosh, they make this look so easy and I’m totally lost – I’m never going to understand how this works. Obviously I don’t want to look like an unprepared and incompetent fool in front of a class, but hey, things don’t always go perfectly. I’m human, you’re human, we’re all going to make mistakes, but that’s part of learning, so let’s talk about what went wrong and how we fix it.
By the way, in case you’re wondering what did actually go wrong in this instance, I had inadvertently moved the data file in the process of uploading it to my Github repo – I thought I’d made a copy, but I had actually moved the original. I quickly realized what had happened, and I knew roughly where I’d put the file, but it was in some folder buried deep in my file structure that I wouldn’t be able to locate easily on the spot. The quickest solution I could think of, which I quickly did off-screen from the webinar (thank you dual monitors) was to copy the data from the repo, paste it into a new CSV and quickly save it where the original file should have been. It worked fine and the demo went off as planned after that.