From the course: R for Data Science: Analysis and Visualization

A note about AI in R

- [Instructor] Before we get too far in this course, I want to take a moment to discuss a topic that's probably on a lot of people's mind, and that is about the potential ability to use AI in R and other data science languages. You know, we have this idea that we can sit there and we can talk, and we've got are little translucent AI robot friend who will solve everything for us. And anybody who's worked with AI knows that sometimes it does amazing things and sometimes it crash and burns spectacularly. That general rule applies to using AI for R as well. Now, there are three different ways to access AI in R. The first one is if you have an IDE, an interactive development environment, that can have AI baked in. So for instance, if you use Visual Studio, you can use Microsoft Copilot. And significantly, with RStudio, the environment that we're going to be using, there is a potential for integration with GitHub Copilot if you have a paid or academic account. Now, that's a form of code suggestion, but it is based on AI, it uses a large language model, but I won't be using it for this course, in part because it gets away from the basic things that I'm trying to show you in terms of learning how to use R and RStudio at the very beginning. I don't want to go launched off into AI doing the work for us. We're doing things that are still pretty fundamental. I do want to mention, there are some other options. There's also a collection of packages that you can use in R to integrate, say for instance, ChatGPT or something like that. But they require that you use APIs and you have access codes. And I've tried them and it just doesn't seem to work very well, not yet. And then there's the tried-and-true copy and paste. Do your AI work in whatever environment you want, copy your output, put it into R and see how well it works. Now, any one of those could theoretically work, but the standard rule of thumb with AI applies: pay attention. Sometimes you'll get things that'll work really well, sometimes you'll have to go through 10, 20 revisions and it still isn't quite doing what you want. I'm going to put this in the category of not yet ready for prime time, but things are developing quickly, and I imagine that especially as GitHub Copilot becomes more commonly used in RStudio that we'll see a lot more of the promise of AI and R in other data science applications. So all I can say for right now is pay attention, be careful, but stay posted.

Contents