 Hi, folks. This is Dr. Don. I'm going to take a few minutes and do a walkthrough of the Lab 2 remix and report portions of the Lab assignment. I've already started up my RStudio, and I've opened up the student name RMD file and made a copy of that, and I've renamed it with my name. You can see it up here. Lab 02, D, right. And also in the first portion, I put my name and the date in there. Okay, so now we read down, scroll through this. You can read that and you should. First thing we're going to do is load the libraries. I'm just going to click on the green run button to run that current chunk. And wait a few seconds here and look for the ready prompt down here in the bottom. And I've got that, so now I can go on down. The next thing we want to do is create our data frame we're going to use. We're using the GapMinder package. Remember, we just opened that in the library right up here. Now we want to create a data frame that we can use. So we're going to run this. Click and there we've got our GapMinder data frame. It already opened this little blue triangle circle that you click on and we'll expand it. You can see we've got six variables, 1704 observations, and here are our variables. We've got country, continent, year, life, expectancy, population. Let me drag this down a little bit. And the last variable there is the GDP per capita, which is what we're going to want to use. So that's how you can inspect your data frame. Sometimes if they're very big, you may just want to double click on the name and open it here in your source editor window. So let's go on down. And the first thing it says, we're going to look at income, but we're going to start by looking back what we did in the rehearse. And it says in section 8.2.3, you made a histogram. Copy that code chunk and rerun it here. So I'm going to go back over here. I keep windows open and you can't see that tab there. But here is my rehearse 2 and I've navigated down to 8.2.3. And here is that code chunk, code chunk 27. So I'll just copy that code, go back to our studio. Put my insertion cursor there and then control V to paste that code in. Now we can run it. You can see we've got a histogram of life expectancy from GapMinder. And this is not quite a bell shape. It's trying to be bell shape, but we've got a peak here. But it doesn't really have a really bad skew either to the left or to the right. But we can look back at this and pay attention to it here. You can see in the first row, we're calling the ggplot function. And we're going to use that GapMinder data frame. And we want our x aesthetic, the x variable to be life expectancy. And that's this variable over here. And then the next line, we have the geometry. We want a histogram and we tell it we want color equals white, which would be the lines around the histogram. 50 bends. And say what? Let's go through this and I'll just show you this. If I want to just run the very first line of code, I'll stop before the plus. And then I use on a PC control inner. I don't know what that is exactly on a Mac. I've looked it up, but you see we created our basic graph and we've got life expectancy down here on the x-axis. So that's what that first code does. And the plus, of course, in ggplot tells us there's another line. So let's run the first two lines. Stop before the plus control inner. And now we've got our basic histogram there. And you can see it defaults as I didn't give it a name for the x-axis and y-axis. It defaults to the name of the variable that I put on the x-axis. And then it gives just a count, which is a standard on the y-axis. So if I keep running it line by line like that, and I'm going to add this theme, which just gets rid of some of the background there, control inner. Now you can see we just simple white. That's all that's changed. And then the next three things we're adding a label for the y-axis, the y-label, the x-axis label, life expectancy, and the title for the graph, gg title, histogram of life expectancy from Gapminder. So now we just again run the whole chunk. And we've got our y-label, x-label, graph label, and our nice histogram. So that kind of gives you an idea of what we're going to do here. As we scroll on down, you should read all of that. The next phase is to take that code chunk and we're going to do some editing. And I've added some commentary here in order to tell you what I've done. The first thing I did, the little pound sign makes that a comment and not a line of code. Change the x-aesthetic variable to GDP per cap. Remember, I looked over here and I saw that GDP per cap is how they spell and capitalize that variable. And that's what we want to run for income. And I added that in down here in the first line. The x-aesthetic is now GDP per cap. We didn't change the second line, which is just the color white in the bins. But we've added this layer to focus because the GDP per cap changes so dramatically from what we had before. We're going to put an x limit and we want to go, this is our combined function, 0 for the min and 50,000 for the max. At least it's easy for us to see the chart. There's a theme again. And now I went through here and just changed the titles to something more appropriate. Number of countries for x, GDP per capita, excuse me, for y, GDP per capita with a dollar sign for x. And then the chart title down here at the end. And now I'm just going to run that. You can see we've got our chart. So that's the first problem and you'll see basically that's how we work all the way through the lab one. So I hope this helps.