Resources

AI-Powered Data Science in Positron

We're so excited to introduce Positron, a free, next-generation data science IDE that makes it easy to work in both R and Python. Positron builds on our years of experience developing RStudio and is a fork of VS Code, designed specifically for data work. This means you get a modern coding interface with features tailored for data science, like a built-in data explorer, AI assistance, interpreter management, and more. This is our 2nd event in our Positron series and focused on AI-Powered Data Science. Here at Posit, we strive to create products where AI works with you, not against you. In efforts to continue this mission, we are excited to introduce agentic AI capabilities in Positron, our new, free code editor for R and Python, that are designed from the ground up to follow these principles. Positron’s AI capabilities automate the tedious parts of the data science workflow, but always keep you, the expert, in control. 00:00 Introduction 00:32 What is Positron? (The Next-Gen Data Science IDE) 03:43 Introducing Positron Assistant 05:10 Bring your own LLM 05:47 Your environment as context 07:19 Inline code suggestions 07:58 Introducing Databot 08:22 The WEAR loop 10:15 Demo time 10:56 Opening Positron Pro in Posit Team 14:29 Opening a new folder in Positron 15:22 Cloning a repo from GitHub 17:24 Positron icons 19:15 Positron search bar and command palette 20:18 Changing interpreters and opening a Quarto document 21:30 Running code and populating the Variables Pane 22:41 Using the Data Explorer 25:28 Creating a plot and debugging with Positron Assistant 30:46 Editing code using inline code suggestions 34:42 Sharing a Quarto document 36:12 Opening Databot 37:02 Exploring data with Databot 43:37 Creating a report using Databot findings 45:12 Wrap up Additional resources: GitHub Repo for this Example: https://github.com/posit-dev/positron-ai-workshop Getting Started with Positron: Quick Tour: https://posit.co/resources/videos/get-started-with-positron-a-quick-tour-and-community-qa/ Introducing Databot (Blog Post): https://posit.co/blog/introducing-databot/ Posit AI Newsletter: https://posit.co/blog/2025-09-26-ai-newsletter/ Positron Assistant: https://positron.posit.co/assistant.html

image: thumbnail.jpg

Transcript#

This transcript was generated automatically and may contain errors.

Hi everybody, my name is Ryan Johnson and I'm a Data Science Advisor here at Posit and I'm really excited to be back for another Positeam workflow demo where I'll be discussing Positron, Posit's newest IDE.

Now in a second we're going to jump into a few slides and talk about Positron but then we're going to spend the remainder of today inside of Positron doing some data science that's powered by AI. So without further ado let's go ahead and jump into it and get started.

What is Positron?

All right so let's first talk about what is Positron. For this demo we're going to define Positron as an AI-ready multilingual IDE for data scientists but of course it can do a whole lot more.

Now if you've never heard of Positron before maybe you've heard of RStudio. RStudio is an IDE that we developed at Posit probably 15 years ago at this point. It's extremely stable, it's beloved by our users and it really is optimized for data science because as you're working with data you're creating variables which you can actually interact with in the variables pane and maybe you're creating plots or tables which you can also interact with and see directly inside of the IDE itself.

Now there's also another popular IDE it's called VS Code and while you can't do data science in VS Code this tends to be an IDE that's extremely popular amongst software developers because it is multilingual so you can use R, Python, Julia, HTML, JavaScript. It's extremely customizable and in newer versions of VS Code it actually comes AI-equipped with things like GitHub Copilot.

So when designing Positron we really wanted to take the best of both worlds. So we wanted to take the features that make RStudio optimize for data science and bring that into Positron and then also bring in some of the cool features of VS Code to create this perfect data science focused IDE.

Positron's layout

Now again if you've never seen Positron before this is what it looks like in all of its glory. And you'll first notice that there's a lot of windows and buttons to click but we can actually just break down Positron into four components.

Over here on the left hand side we're going to call this like your manage area where you can manage things like what files are in your project. You can manage things like version control, your extensions which we'll talk about in a little bit. That's all done over here on the left hand side.

Now as you begin writing code whether it be an R script, a Python script, a Shiny application, a Quarto document, that's all going to be done right here in the top middle of your screen. And typically when you open up Positron for the first time you'll see this welcome page with some helpful links and buttons.

Now as you go to run code whether it be R or Python code because Positron supports both, that's done down here at the very bottom where you get an interactive console. And again you can switch over to a Python console very easily. Now as you begin working with data again you're probably going to be creating things like variables or subsets of your data and they're going to be stored in memory. So any variables that you're creating you can actually see them over here in the top right hand corner and then any plots or tables you're creating it will show up down here.

There's also a viewer tab up here so if you're running things like a Shiny application or you render an HTML document, a Quarto document, that's all going to be done over here on the right hand side which really helps you understand your data.

Positron Assistant

So that's kind of the Positron 101, but for today's demo we're going to be focusing on some of the AI features that we've either built into Positron or as built as an extension of Positron. And the first one that we're going to get practice leveraging today is something called Positron Assistant.

So Positron Assistant again is an AI client that is directly built into Positron. In fact on the left hand side of Positron you'll probably see this little robot face, that is how you can access Positron Assistant.

And Positron Assistant can do a lot of great things and you can also interact with it in a lot of different ways. So when you click this little robot face it'll open this sidebar and you'll get a text box down there is another way where you can interact with Positron Assistant known as inline edits and we'll talk about that here in a second.

But something that's really important about Positron Assistant as well as a lot of the other AI tools that we're building for Positron is that this tool is model agnostic and it follows our bring your own LLM or bring your own model philosophy.

Now currently with Positron Assistant as of today it's still in preview support. We do only support Anthropic but we are actively testing out other models with the hopes that whatever model your company or group is approved to use that you can bring that model to the table.

So here's a window that you can open up in Positron where you can select your various model. Again, currently we only support Anthropic, but here you can see some other models that we're testing out including AWS Bedrock, Gemini, GitHub Copilot is supported currently for code completion, but we will hopefully support it as a full-fledged LLM in the near future and others as well. And setting up these models is super simple. Like, for example, with Anthropic, you can just apply an API key. It tends to work pretty seamlessly.

Now the other important thing to note about Positron Assistant is that it is designed for data science. And when I say that, I mean that it's designed to have context awareness. So when you start interacting with it, it knows about your data science environment.

So here I have another picture of Positron and here's Positron Assistant over here on the left-hand side and I purposely gave it these really creepy eyeballs because as you interact with Positron Assistant and you ask it questions down here, it can actually see your environment. Things like what scripts do you have open? What variables do you have stored in memory? What plots or tables have you created? What code have you run and what output from that code was run? It can see that.

That way, when you ask it questions, typically the suggestions that Positron Assistant just tend to work immediately. Another way to think about this is if maybe you're using like ChatGPT or Gemini to help with some code assistance, you're using like the web interface. If you have a code question, typically you have to copy and paste all of your code, copy and paste the error message, potentially copy and paste a subset of your data in order to give that model enough context to provide hopefully a useful suggestion. But with Positron Assistant, you don't have to do that.

But with Positron Assistant, you don't have to do that. You can give it a simple request and it will understand your context and provide suggestions that, again, just tend to work.

You can give it a simple request and it will understand your context and provide suggestions that, again, just tend to work.

Now, that text box down here in the sidebar is one way to leverage Positron Assistant. But there's another one known as inline code suggestions, which we'll do in today's demo as well. But the idea here is that maybe you have a script open. It could be a Quarto document like in this screenshot. It could be an R script, a Python script, a Shiny app. And you can place your cursor somewhere in this document and hit Control-I if you're in a Windows machine or Command-I if you're on a Mac machine. And it opens up this little text box. And this is Positron Assistant. You can ask it questions and it will provide suggestions inline with the rest of your code.

DataBot

Now, Positron Assistant is one tool that we're going to focus in on today. But the other one is something called DataBot. Now, DataBot is actually available as an extension. So, it's not built into Positron like Positron Assistant. It's available as an extension.

But to talk a little bit about DataBot, I first want to help clarify, like, when to use DataBot and when to use Positron Assistant.

DataBot is specifically designed to do exploratory data analysis and to do it really fast. And actually, it's surprisingly a lot of fun. So, imagine you get some brand new data thrown at you and you want to analyze it. That is a really good use case for DataBot.

Now, for Positron Assistant, this can certainly do a lot of things that DataBot can do. But it tends to be more task-focused. So, maybe you have an error that you need to debug or you have a plot you want to approve or you want to create, like, an individual table. Those are really great tasks for Positron Assistant.

Now, the way that DataBot works to do this exploratory data analysis is it implements what we're calling this where loop. So, you have some data and you want to learn more about that data. So, you ask DataBot to start analyzing it. And what it's going to do is first write some R or Python code. It will execute that code immediately, analyze the results, regroup with suggestions, and then just wait for your next instructions. And this will just go around and around and around in circles until you're happy with the results and you've gleaned all the information you need from that data.

Now, it's also important to note that this where loop and also the way that Positron Assistant works is that it's all code-based. All the suggestions you're getting from DataBot are just code suggestions. And we think that code is the most auditable way to explore data with AI. Because you're not just asking it a question and then sending it off into some black box and getting a magical response. You are actually getting code. You can see that code. You can approve that code before it actually gets run.

And we think that code is the most auditable way to explore data with AI. Because you're not just asking it a question and then sending it off into some black box and getting a magical response. You are actually getting code. You can see that code. You can approve that code before it actually gets run.

Demo: Positron 101

All right. So, with that, we're going to jump into Positron. And we're going to demo all these really cool features we just talked about. So, the first thing we'll do is we're going to give you all just a little Positron 101, get you comfortable with the user interface. We're then going to step into doing some AI-powered data science. And we're going to begin with Positron Assistant. And we're going to use Positron Assistant to help us debug an error. We're then going to improve a GG plot. And then we'll even create a GT table from scratch. And then we're going to wrap up today by doing some fast exploratory data analysis with DataBot.

All right. So, I'm going to go ahead and switch over to my demo environment for today. And I'm going to be using an instance of Positeam. And just for awareness, Positeam is our bundled offering of our three professional data science tools. We have Posit Workbench for doing your development. We have Posit Connect for sharing all the insights that you're creating with others. And then we have Posit Package Manager for organizing, centralizing, and delivering all those amazing open-source R and Python packages.

Now, for today's session, we're pretty much going to be staying within Posit Workbench. So, I'll go ahead and click on this tile. And here is the new Posit Workbench homepage. So, if anyone here has used Posit Workbench in the past, you may notice that the landing page for Posit Workbench looks a little bit different. So, in our most recent release back in September of 2025, we've modernized and just, I think, makes it a lot better looking, this landing page for Posit Workbench.

And you can see all these various rows on this landing page. And these are all various projects that I've been working within and various directories. But for today's session, we're going to go ahead and kick on a brand new session. So, I'm going to click New Session at the top of my screen. And we get this pop-up window.

And at the very top of this pop-up window, here are currently the five IDEs that we support within Posit Workbench. So, we have Jupyter Notebooks and JupyterLab, which tend to be more popular with our Python users, but you can certainly use R in it as well. We have RStudio, which has always been a member of Posit Workbench, great for R development. We have VS Code, a great all-purpose editor. And then importantly, you'll see right here in the middle, the newest member of the IDE family, Positron. And that's what we're going to be using today.

So, we can go ahead and change the name of the session if we want to, but I'll just leave it as Positron Pro Session 2. I do want to talk a little bit about session credentials here, because I think it's a really cool feature that's unique to Posit Workbench. If your data or assets live in something like AWS in this example, or potentially it lives in Databricks or Snowflake, you'll know that when you go to access that data, you typically have to create like an access token and then apply it to your various IDE environments. And it can be a bit of a hassle.

Here with session credentials, you can click on any of the tiles, sign in, and then your credentials will be applied to your various sessions automatically. So, it can really help save some time and some headaches in making sure that you can connect to your data and assets in Posit Workbench. Here we've created a custom Docker image to deploy these various sessions within.

And then lastly, you'll see cluster options. So, this demo environment is actually running in a compute cluster. And the advantage here is that I can actually set my resource profile. So, if I want to have just the default settings with one CPU, about four gigs of memory, that's probably fine for today. But maybe I want to do a medium setup with a little bit more CPU, a little bit more memory. And these settings are actually pretty easy to set up. So, I'll go ahead and select medium, and we'll go ahead and launch the session.

All right, you'll see at the very top, the Positron Pro session is now launching. We'll give it a few seconds. Now it's dropping us right inside of Positron.

All right, so, here we go. This is Positron. I'll just go ahead. I'm going to set up the stacked workflow. So, if you see in the top right corner, these various icons, I like to use this stacked layout, because it kind of emulates what you'll see inside of RStudio.

Okay, so, when you open up Positron for the very first time, this is typically what you'll see. You'll have your welcome page here. You have the sidebar off to the left-hand side. And the first thing that I want you to notice is that Positron really, really, really wants you to open up a folder. All right, you can see in the welcome screen, has open folder, new folder, new from Git. You can open a folder here, clone a repository, or you can click the dropdown, open a folder here. And that's typically how you should operate with your various data science projects, is that they should be inside of a folder.

So, we're actually going to pull in a project from a Git repository. So, I'm actually going to select this new from Git icon from within this welcome page. And we'll get this window where we need to supply a URL for our Git repository. So, here's a project on GitHub, a repository that we've created for some workshops. And I'm going to go ahead and just grab this URL, come on back to Positron and paste it in. And then we'll click OK.

Now, anytime you create a new project inside of Positron, it always opens up a new Positron session. So, we'll give it a few seconds here to boot up. All right, here we go.

And we'll know we're in the right place because we see now over here on the left-hand side, this icon in the very top left, this like page icon. This is your file explorer where you can see what files or datasets are inside of your current project. So, these are all the files that I just pulled into my Git repository. And if we just quickly run through them, you'll see there's some CSV files and they correspond to various years from 2015 to 2019. We're going to be exploring this data here in a second.

You'll also notice that there's some QMD files, which again stands for Quarto. And we'll be talking through some of these as well, including the Python one and this R one. There's also a README file down here and an RNVLOC file, which is associated with the RM package that we created here at Posit.

Now, we'll also know we're in the right place if you look in the top right corner, you'll see the Positron AI Workshop one. That's the directory that I'm currently working within.

All right, so to get started here, let me just navigate you from the left-hand side, this ribbon over here. I mentioned in the slides, Positron Assistant. That's the little robot face down here. We're in a very short amount of time. We're going to actually open up Positron Assistant and play around with it. But I want to get you kind of familiar with the rest of Positron.

So kind of moving through some of these icons, you know, we would highly encourage you to play around with them, see what these various icons do. But I just want to point out a few of them. The first one here is source control, version control. Now, I've been an RStudio user for like over a decade and the get features inside of RStudio are good. But I would say that the get features inside of Positron just take it to a whole new level. All right, you can see here this repository, all the various commits that we've added. We have the ability to access a lot more get commands directly within Positron. And if needed to, you always have access to the terminal if you need to access get more natively.

And then the other icon I want to point out for right now is going to be these squares. These are known as your extensions. Now, for anyone here who has never used VS Code before, this may be a bit of a foreign concept, but extensions are a way for you to install these extensions that help kind of modify and fine tune your developer experience. Now, by clicking on this extensions icon, it actually shows you all the ones that are currently installed, including this, you know, our language support formatter called air, which is really cool. But importantly, the second one down here is data bot. So data bot, that extension I talked about to do fast exploratory data analysis.

And you'll see it as a few other ones as well that we pre-installed into this demo environment. But if you wanted to install another one, you can search the marketplace up here and search for, you know, whatever extension you want. And what's really cool about Positron is that it's built on the same open source framework as VS Code. So for the most part, any extension you use in VS Code will also work in Positron.

Now, the only other thing I'll mention for right now to get you familiar with Positron is this search bar at the very top. Again, if you're a VS Code user, this should look familiar. But if you're an RStudio user, this may be a new feature. And it's a really important one in Positron because it can do a variety of things. But what I want to point out for right now is something known as your command palette. And there's a few ways you can access the command palette. You could click this search bar and select show and run commands. It essentially just puts a little greater than symbol there. That's one way. Or it is a keyboard shortcut. So I'm on a Mac machine, it's command shift P. I think it'd be control shift P if you're on a Windows machine.

And then here's all the various commands. And you can see some of them are associated with extensions like air. There's so many to choose from. It could certainly be a little bit overwhelming. But just know that this actually has really nice like fuzzy searching. So for example, if I wanted to open up a file, if I didn't know the actual command, I could just say like file open, something like that. And there you go, open file.

Exploring data in Positron

All right. So in order to get kind of familiar with the rest of Positron, we're actually going to first open up a Quarto document. Now, before I do that, I want you to take your attention up here to the top right. You'll see currently in this Positron session, I'm running R version 4.4.0.

Now I mentioned before that Positron right out of the box is designed to work equally well with both R and Python. So I could easily click this button, select a new interpreter, and open up a Python session. And that would work perfectly fine. But what I could also do is you'll see there's a Quarto document called python.qmd. So let me go ahead and click on this file. Again, it's going to open up here in the top middle. And you can always click and drag the dividers of Positron to give you some more space.

Now, if you're not familiar with Quarto, in a lot of ways, they're similar to like R Markdown and also Jupyter Notebooks. It's a way for you to combine both code. You can see these like gray code cells with some text here, which will ultimately get rendered to HTML.

Now, by opening up this Python Quarto document, you'll notice something kind of cool. That Positron automatically detected that this Quarto document includes Python code. So without me doing anything else, Positron automatically opened up a Python kernel for me. So now you can see I currently have Python version 3.12.3 running. And I could even switch back to my R version. This is an insanely powerful feature of Positron where you can have both R and Python running at the same time. You can even have multiple R versions and multiple Python versions all running at the exact same time. And they all have their unique environment.

Now, if I was to run a cell here within Python, so I can click run cell here above line eight, and it's going to do some things like import some packages, but it's also going to create a variable called happiness. And what this line of Python here on line 16 does is it reads in a CSV file that's in my project. It's this file over here, 2019. And so by doing so, you'll notice over here again in our sessions pane, we now have some variables created.

And this is a powerful feature of Positron. You can see the variables you've created and you can actually interact with them. So here I've created this happiness data. And if I click on this grid icon, it's going to open up our interactive data viewer inside of Positron.

All right, you'll see that it opens up here in the middle, but I'm actually going to hide some of my windows here to give us some more space. And I think this is an important thing as you get more comfortable using Positron to be aware of windows, sidebars, and you can always hide them and pop them back in.

A lot of that you can do up here in the top right hand corner. So right now I don't need my files pane over here on the left hand side. So I'll hide that. I'm going to go ahead and hide this sidebar off to the right, which I can click this right one here. And I'll go ahead and hide my console, which is the middle button. And now we can see this really cool data viewer in all of its glory.

So this is looking at, again, at this happiness variable data set that we created. And if you see here, we get a nice scrollable view. This is in a lot of ways similar to the data viewer inside of RStudio, but it's a little bit more powerful. And we can also see over here on the left hand side, all the various columns and information about those various columns, like if they're numeric or a character, and you can click on them and get some more statistics about each individual column.

Now this data set, and I'll just point you to two columns here, you'll see it's looking at various countries, and then they're being assigned like a happiness score, like how happy are these various countries. It also includes some other information like GDP, social support, and it gives various scores there as well.

So with this data viewer, what you can actually do is you can interact with a column by clicking these three dots. You can sort them. You can also add a filter. So for example, if I wanted to filter all the various rows here where the score is, let's say greater than seven. I've now done that. And then maybe I also want to filter my countries. Or maybe I'll filter the rank actually. I'll say add a filter and I want to extract just the top 10. So I can say is between one and 10. And I'll apply that filter. There we go. There's our top 10 happiest countries in 2019.

Now, a really cool feature that's currently available in Python and coming very soon to R is if you look up here at the very top, you'll see convert to code. So as you do like sorting and filtering and other transformations to your data set here in the data viewer, if you want to make that repeatable and reproducible, you can simply click this button and it will actually spit out, in this case, some pandas code so you can replicate what you've done to that data. And I think that's a really cool feature that you only find in Positron.

Debugging with Positron Assistant

All right. So let me go ahead back in here. And what we're going to do next is I'm going to open up another Quarto document. So we've been dealing with Python so far. I'm going to close out of this one. We're going to open up this R.qmd file, which in a lot of ways is similar to that same document. All right. If I run that first code cell again, it will create another happiness data variable here. It automatically switches me back over to R, which I think is super cool.

And we're going to scroll down a little bit more and we're going to create a plot. So here in this Quarto document, starting on line 25, we're creating a ggplot, looking at this happiness data, and we're going to go ahead and run it. Uh-oh, we got an error message. So if you look down here in the console, it looks like we got an error message saying happiness data not found.

Okay. So this is like, you know, somewhat intuitive error message. But for those that are developers, you'll know that sometimes error messages aren't typically helpful. So in order to debug this issue, we're actually going to use the help of Positron Assistant. So again, Positron Assistant is this robot face over here. So let me go ahead and click on it.

And I'll expand out the window, give a little bit more space. And here you can see Positron Assistant. It's actually already been configured with AWS Bedrock. But if you needed to set it up for the first time or change your models, you can select this dropdown and select add model provider. So here in this demo environment, you can see again, we have some models that we're testing out. Anthropic being the main one. Here internally, we also use AWS Bedrock.

Okay. So we have this error message and we don't really know how to fix it just yet. And so what we're going to do is we're going to give a message down here to Positron Assistant. And what I don't have to do is I don't have to copy in the code. I don't need to copy the error message. I can just come down here and say, help me fix the error.

And I know it's a little hard to see, but you can also see down here that we've added some context to this. And a lot of times it just picks it up already. So you can see it's already knows I'm using R. And it's already is using this R.QMD file. It's currently active by active editor here. And if you wanted to add additional context, maybe some other files or data sets in your directory, you can do that as well. But again, Positron Assistant out of the box will have more context. Like it'll be able to see my console and actually interpret the error message. So with that, let's go ahead and run it and see what we get.

All right. You can see as it's finishing here, it's used one reference. That's my Quarto QMD file. And let's read the error message. So it says the error occurs because the code references happiness data. So that's right. On line 25, you can see happiness data, but the data frame is named happiness. Okay. So that's where I made a mistake. You can see my variable is actually called happiness, but my code is referencing happiness data. And then it actually gives us a little code suggestion, which is great.

Now, if we want to try running this code and see if it works, you can click the little play button right above it. So I'll do that. Uh-oh. It looks like we got another error message. Object gray 70 not found. Yeah. It looks like we're trying to make a color gray 70, but like, why is that not working? Gray 70 is a valid color. Let's go ahead and ask Positron Assistant. And I'll just say, what's wrong now? Question mark. Again, I don't need to provide much other context.

All right. The color gray 70 needs quotes since it's a string. So there we go. I forgot my quotes. And now it provides another code of suggestion. I can try running it. And there we go. We actually can see our plot directly here within Positron. Again, another really cool feature of Positron. And it looks like we have GDP on the X axis and happiness on the Y axis. And all these individual circles represent countries in 2019.

All right. So this seems to be working, which is great. So now it's time to actually bring that code into our active editor. We want to replace this erroneous code with the new code. So by hovering my mouse over this code chunk, I can select the second button called apply an editor. And I'll select the active R.QMB file.

And what it's going to do is Positron Assistant finds inside of this Quarto document where this code needs to be put in. And will actually give us a diff. And here you can see it. So a diff essentially gives you control as a data scientist. So you always remain in control. The opportunity to either reject or accept a change suggested by Positron Assistant. Anything in red is being deleted. Anything in green will be new lines of code. So I know this is what I want. So we could select this individual one or we can just keep all the suggestions. And I'll select that.

And there we go. And if I rerun the code cell, you can see it just generated the same plot again. But a really cool feature of Positron is you see all the various plots you've been creating. You kind of get this really nice timeline you can go back to.

Improving a plot with inline edits

All right. That's really cool. So we have this cool plot. I would say it's cool. But it could probably look a little bit better. All right. It's kind of bland with like these gray dots. We don't know what these various dots are. So we're going to use Positron Assistant specifically the inline editor. Or inline suggester to make some improvements to this up.

So I'm going to go ahead and place my cursor just somewhere inside of this plot here. And I'm going to hit command I. That brings up this Positron Assistant prompt. And I'm going to suggest something. Again, you can kind of do whatever you'd like here. But maybe I want to label all of the outliers and I plot. And let's see what happens. I'll hit enter. It's going to think for a little bit and it should provide code suggestions.

All right. And you can see here, it's now actively applying those edits directly to my code. All right. Now, before we, you know, either keep or undo these suggestions, we can rerun the code cell here at the in the background. And see what we get. All right. Well, it's OK. It looks like we got one