 I'm John Little, and you're watching the Introduction to R Instruction series. The series is part of the RFUN Learning Resources website, sponsored by the Center for Data and Visualization Sciences, a part of the Duke University Libraries. In this section, we'll explore how to access RStudio, how to access and load a local or import a local data file, for example, a CSV or comma-separated value file, how to download a GitHub repository into RStudio, how to clone a GitHub repository directly into an RStudio project, and how to launch an RStudio project. So let's get started. Right. To access RStudio, I'm on a Windows machine, so I'm just going to click RStudio, which is in my taskbar, but you could click the Start menu and just type, start typing RStudio and you'll launch RStudio into its base view. In the next series, we'll talk about the environment of RStudio, but let's just talk about importing a data file this time. So I have, in this case, an environment pane, a files pane, and a console pane. My goal is to import a CSV file. Now I could just as easily import an Excel file, or an SPSS file, or a SAS file, a state of file, et cetera. So I want to import the CSV file that I have on my desktop. If I go to the environment pane, I'll find a button for the import data set wizard, and I can drag down and import several different types of data files, but I want to import a CSV file. Now there are two different ways you can do that. Either one of these, I recommend the latter reader, part of the reader library is part of the tidyverse. The baseR function will work fine. All right, once I'm in this data import wizard, I can browse to where my data are. In this case, the file is on my desktop, and it's right there, broadheadcenter.csv. So I'll click on that and I'll click open. RStudio's data wizard will automatically give you a preview of the data. In this case, grid data, rectangular, and it will tell me the names of each of the columns, and it will tell me the data type for each one of the column vectors. So most of these are character data. The last two are double or floating point decimal type numbers. If I wanted to change the name of the object that was being imported, I could type broadheaddata. I could change it to anything I want, and if I hit tab, nothing will change up here, but it did automatically change the code down here in the code preview. I have the option of changing the delimiter type. So if it doesn't comma-separated value, but is separated by some other type of code, I could do that. By default, selected for first row as names, which means these column header names. But if I had data that didn't have column headers, it would assign these generic column headers. And you can see what happened is my column headers now became row one. Which is not what I want. So I'll select that again. And there are several other features. Now, notice that all of the code from a reproducibility standpoint, I actually want to write this, put this code into my R Markdown code chunk. But for the time being, we could get away with just clicking import. Before I do that, I'll click on this clipboard icon to paste all of this code into my buffer, and then I can paste it into my script. Right now, I'll just click import. So what have I got there? Automatically by clicking import, down in the console, our studio launched the view function with a capital V, the broadhead underscore data object. And then it allowed us to view that object in this upper left-hand quadrant. I'm going to minimize the console because I don't need that any further. And you can see more of the data that we had seen in the preview. And you can get some basic information, 59 entries, meaning 59 rows, meaning 59 observations, and seven columns, or seven variables. All right, I get that same kind of information right over here. Broadhead data is the object name, 59 observations, seven variables. And if I wanted to, you can see over here there's a little icon on the right. If I close this data set and I want to see it again, I can just click on that icon. Once again, it will launch this command that I can type in my console or in my script. I can also expand this view of this object and get more information about the data. We can talk more about that later. And down at the bottom, I have a view of my files. And these are all the files in my general RStudio, not using any projects. So what are our studio projects? Well, let's talk about that for a minute. Projects are a way to organize your research into different folders, folders or directories on your local file system. And so every local file system will be its own RStudio project and you can keep things all together. For example, if I go down here and choose, you can see that I use lots of projects. If I choose Workshop, RFun, Flipped, that's my project for this video series. And when I open that up, there's one thing in there. Well, there's a lot in there, but there's a data directory that I had imported earlier in a different session, the same data file. Kind of let that confuse you. And so that's a project. If I wanted to have two projects open at once, I could, for example, go over here to test one and I'll, I can, if I click it over here, it'll close the RStudio project. I have open and open test one. But if I want to have them both open at the same time, you can click on the one on the right and you'll launch a second RStudio instance, a separate project, looking at the data in that project, which is there. And if I use Alt Tab on my Windows machine, you can see that I have two different instances of RStudio open and I can switch back and forth between the two. All right, I'm going to close test one. I'm also going to close this project because the next thing I want to do is talk about how you download or clone a GitHub repository. I'm going to talk about download first because at this point in the video series, you are probably new to R or RStudio. And since I'm teaching on a Windows machine, there's one more step that you'll have to do at this stage to open your data into an RStudio project. All right, so I'm going to go to GitHub. And I'm going to go specifically to my profile. My profile ID is life, John. Up here at the top, I pinned my intro to R code for my intro to R workshop. So I'll open that up. And when I look at that, you can see that there are several files in this data repository, including data in the data repository and slides. All of those things you can download to your home computer simply by clicking on the green clone button and then clicking download zip. We'll talk about clone in a minute. So all I'm going to do here is download all of the files on that website to my local file system. You can see that I did this once before. I'm going to click on the up arrow in the context menu and choose show and folder. This will show me where I downloaded my data. As it turns out, I did this just a minute ago, so let me get rid of this one. So I open my file explorer and there's a copy of my intro to R code zipped into a single file. Now at this stage, you're going to want to expand that file. While you can look into that file, I'm going to encourage you not to do that because it's going to make future work more difficult. So instead, right click on that file and choose extract all. I'm going to say that twice because it's really important and it's a step that people often sort of want to skip. So it's a zipped file and I need to expand it. I'm going to right click on it and extract all. Probably if you're on a Mac, you can just double click and it will extract by itself. Now I can put this anywhere I want. So I'm going to put it on my desktop and click extract. And I'm going to close my file manager. I'm going to minimize web browser. Okay, so on my desktop, I've extracted it into that folder. It's no longer a zipped folder, so if I double click on it, I can see all of those files that I saw at the GitHub repository. And what I'm looking for is I'm looking for this .RPROJ or R project file extension. And if you don't have your extensions visible, you're just looking for the hexagon-shaped icon or the RStudio file icon. Let's see if I change the view of this to large icons. Looks like that, okay. So all I need to do at this point is double click on this and it will open all of those files into an RStudio project. So I've just downloaded, expanded, and opened everything into an RStudio project. Again, the project name is listed there. If I want to shift to a different project, I can just do that in real time. And again, I still have two copies, two different instances of RStudio because I have two different projects going at the same time. I'm going to close this one again so it doesn't get confusing. The last thing I want to note is that you can clone a GitHub project. So I'm going to go back here to the website so that I can click on this clone button again. Now I want to note, not 100% certain, but I'm fairly certain that if you're on a modern Mac, you don't have to do anything special to make cloning work. If you're on a Windows machine, you probably have to download and install Git, and configure Git, and I have a separate workshop on that that you can find on the RFun website. I'm going to click on clone, and what I want is I want this code right here. The easiest way to get that code is just to click on the clipboard icon, and so now that code or that URL is in my buffer. Now I'm going to launch RStudio, and I'm going to go to new projects and choose new project. And because I'm cloning, I'm going to cloning something that's on GitHub, and GitHub is a way to visualize version control projects. I'm going to go to version control as I try to import that cloning project, right? So I've chosen version control, now I'm going to choose Git. I'm going to paste that URL that I got off of the GitHub website, hit my tab key, I can browse and put this anywhere I want. I'm going to actually rename this to wait me, because I have a copy of this already on my computer, and I want to make sure I get rid of it. And if I click create project now, we'll replace the RStudio in the background. If I click open in a new session, then I'll have two different RStudio projects open at the same time. I'll just click create project, and you can see some information there where it's telling me that it's downloading the data directly from GitHub. And I can see that I'm in the enter to R, delete me project name, and I can see all the files that it downloaded. This is different from the one I opened a minute ago. Okay, thanks for watching. That was how to access RStudio, load and import local data, download and clothe of GitHub repository, and launch in RStudio.