 So that's access to the console. And of course, as I said, you have all of those commands in the history, but it's not the most efficient way to keep track of your data project. And it's actually pretty easy to lose track of your whole project if that's the only way you're going to interact with R. So I recommend you use a script. The easiest script to get started with is something called an R Markdown Notebook or an R Notebook right there. So I click on this and then choose R Notebook. That'll put up a file that has all the information I need to understand how to use this notebook. But there are two basic components of this notebook. There's prose or natural language, which is structured with something called Markdown. What is Markdown? Well, you can click on this link right here where you can go to help and choose Markdown Quick Reference. And it shows you some information about Markdown. I'll address that in just a second. It also tells you how to create code chunks. This is a code chunk. So that's the separation, prose or natural language that explains your analysis from a code chunk or your actual analysis, right? So in this code chunk, I have an onboard dataset called cars and I'm applying the plot function to that car, to cars. So if this was a natural notebook, I might write something like load data. I'm proceeding that by two dashes because that's the Markdown code to make it a second level header, load data. And then I'm going to insert a code chunk, insert R because I want to do in the R programming language, I'm going to say data cars. Make another header and say visualize scatter plot. Now I might also want to up here at the top and say load library packages. There's a keystroke command for inserting a code chunk, control all I, library, tidyverse. And in this case, I know that when I run tidyverse, it's going to give me some feedback from the console, but I don't necessarily want that in my report. So I'm going to click on this gear and choose or turn these warnings and messages off and maybe say show nothing run code. That's overkill, but that'll work. So I'm loading my library brief explanation about our Markdown, which again, every time you create a new Markdown notebook, you get some of that information that explains how to use a notebook. Then I'm going to execute this code chunk by typing control shift enter, which it says right there, or I could click the green arrow. Or if I wanted to, I could run the whole analysis at once, run all, and you'll notice that there's some other structural markers like this is a hypertext link. And maybe I want the word chunk to appear in bold. So according to that, I'll type bold, type two asterisks surrounding the word chunk. Maybe I want clicking to appear in italics. So I'll put some underscores around that. And if I need to know more about our Markdown again, I could go here, shift enter, and there's a whole bunch of information there or I can get this help and there's even more in the cheat sheets. But this will provide some basic structure to the document in how it gets rendered. So the last thing I'm going to do is I'm going to go down here and I'm going to write executive summary, faster cars, choir, longer stopping distances. And I'm going to create a code chunk, insert R, cars, and then ggplot aes speed on my x-axis, distance on my y-axis and layer in scatterplot and layer in a regression analysis using linear regression. And that generates this, but I don't maybe, this is my executive summary, maybe I don't want that code to show up. So I'm going to put this down here and say show output only. I'm still getting an error message, which I'll have to think about dealing with later. But there is a very quick example of how to create a script that can be rerun. Now in order to rerun it, I'm going to click over here to files. I'm going to save this and I call it test. And R is going to give it a .rmd extension in which it did right there. And it also automatically rendered my first report, test.nb.html. Notice that those files that it just created are still in my file system in the same primary working directory, which R has assigned because I made it an RStudio project. Now, if I want to look at that, I can just click on it, open in web browser. And I can see there's the bolded word, there's the italicized word. Oh, I didn't get my loaded library because I did something, oh, because I did something that I hadn't intended to, which was I said run, show nothing, run code. I actually wanted to show the code. So I'm going to run this all again, click preview, and there we see that it is there. In the preview, I'll hit refresh here. So I want to display to my technical audience that I'm using the tidyverse library. I've got my bolded word, I've got my italicized word, I've got my second little header, and I've got a hypertext link. Here I'm loading data and visualizing the scatter plot. And then down here on my executive summary, of course, I don't want to display the code. I just want to display the visualization. So at this point, a lot of people will ask the question, well, why would I want to do all that? Why do I want to make this notebook? It's just easier to create a straight-up script. But in fact, the more you use the project method that's built into our studio and use markdown to provide structure to your documents, the simpler you will find all of your future projects. Because what our markdown notebooks allow you to do is practice reproducible literate coding, which means that you can integrate your code, your analysis code with your natural language pros to generate multiple kinds of reports. You can generate different kinds of reports, depending on what you need. All of that is done inside of what's called an RStudio project, which is a folder that exists on your local file system. And then you can also apply and integrate within RStudio version control. That's a separate workshop, which means that you can timestamp your whole project and roll back to earlier stages or easily share that project as a repository on GitHub or other social coding networks. Okay, so it's also worth noting that as you integrate natural language explanations around your analysis, explaining your code snippets, you're approaching a more reproducible workflow. And this is an approach that's natural in computational sciences. It creates a functional record of your reproducible research. It's easier to share. And as again, as I said, if you also apply version control to this, it's easy to go back in time and see the whole history of your project without you doing any special documentation about how your project has changed because the version control will timestamp your project as you move forward. Now you may say, well, I don't really need all that, but the truth of the matter is that the biggest collaborator you're gonna face is yourself, separated only by time. So take a project that you created six months ago. Do you fully understand and remember all of the steps that you did for that analysis? Could you share that with somebody else without providing them additional explanation of how the project was done? Probably not, unless you're using this process that I mentioned. I mean, there may be other processes, but this is a very convenient process once you start applying it. And the same thing holds true that you can be sure that something you're doing right now in this environment will work fine in six months in a future. Suppose you get a new computer. All you have to do is move that RStudio project folder onto your new computer, install R, and the whole thing is gonna work. Now it's also worth noting that there are many different types of reports that you can generate or render from this markdown process, right? So we just generated this one, which we looked at right here, but suppose we wanted a Word file for that. That's a simple process. We'll click on preview and we'll knit to Word. Notice that we could also knit to PDF or knit to HTML. But let's knit to Word. It'll take just a second. The file will get rendered and then it'll launch Microsoft Word and I have this same document rendered in Microsoft Word. So in some cases I have the code and the pros with the hypertext links and the visualizations. And in this other case where I decided I didn't, right, I got that error message that I wanted to get rid of. How am I gonna do that? Well, I'm gonna do that this way. I'm gonna turn off the warnings. I save, right? And that works, so I'm gonna save it and I'm gonna re-knit the Word file. And while I'm waiting for that to launch, let me just note, there it is. There is my executive summary. Going back to RStudio, clicking on the files menu, note that I now have my markdown document, RMD, which is right here. That's my script and my two different rendered reports as well as some supporting files. Oh, sorry, those supporting files were just temporary. So if I look at my file system, those files exist there too. And that's in RStudio project file so I can just share that folder with somebody else and it will run on their computer too. As long as I don't use absolute file references, which I talk about in a different video, I could use relative file references. I already told you that you can get markdown help from help, markdown quick reference guide, but I wanna also note that you can also get that help under the cheat sheets. There are two more markdown reference guides and there's also a really nice book on markdown that is called our markdown definitive guide and it's free and online. And there are other types of reports. So those are just two types, but for example, if you wanted to do something like this, our markdown, that gives you a wizard so you can create other presentations, shiny dashboards, templates that include slides if you have the Sherrington library loaded and a whole bunch of other things, right? So if I was to create some slides, okay, it's gonna generate this default our markdown document and I can change the author name to me if I want to. But this document actually is the documentation for how to use the slides and you'll see that in just a second. All you have to do is knit it, but before I knit it, I'm gonna add one slide and I'm gonna add it right here by making three dashes and say stopping and here I'm gonna take this work, this code and put it right here and I probably need to also library tidyverse here. Now, when I knit this, I'll ask me for a name, example slides, it'll knit those slides, show it in my viewer and you can see that I changed my name on the slides and if I use my arrow keys, you can see that my second slide is my visualization for stopping distances and if I click on this show in window where I can look in files are listed right there, you can view that in a web browser, you'll see there's a whole method of generating slides that integrates markdown in our studio and our code. So that's it in a nutshell, how you can use reproducible code in our markdown context within our studio to generate reproducible.