If you have any problems with the PAT process or want to know more about it, the Happy Git and GitHub for the useR book has a great chapter about it. Once this is done, you should be all set for RStudio to communicate with GitHub. ? Enter password or token: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx You should see the following: > gitcreds::gitcreds_set() Once you have copied the PAT, call gitcreds::gitcreds_set() from the RStudio console and paste the PAT when prompted. Copy this by hitting the button with the two boxes. If you use a password manager like 1Password or LastPass, you can put it in a secure note in those programs. You should treat it like a password and do not share it with anyone. You will then see a new screen with a long sequence of letters. We recommend keeping the “scope” selections as they are and clicking the “Generate Token” button at the bottom of the page. Alternatively, if you set it to a date after the semester ends, you shouldn’t have to touch this again. You can accept the default of 30 days but you will have to renew it a couple of times during the class. You’ll have to give the PAT a note that describes what it’s for and choose an expiration date. This will open a page on GitHub asking you to create a “Personal Access Token” or PAT (this is the secret code). Basically, we need to get a secret code from GitHub and store it in RStudio (kind of like a app-specific password when you’re using two-factor authentication). This requires a bit of fidily configuration that we luckily only have to do once. We also need to set up RStudio to be able to communicate with GitHub securely. Git config -global user.email Set up RStudio to talk to GitHub git config -global user.name "John Harvard" Run the following two lines of code in the Terminal replacing "John Harvard" with your name and with your email address used to sign up for GitHub. Once you have a GitHub account, you can configure your local git program to interact with your account gracefully. Since you might use this account to interact with potential employers in the future, you should probably pick a professional username. You can think of GitHub as similar to Dropbox or Google Drive for your git projects (“repositories”) where everything is public by default. If you get any kind of error message, you learn how to install git on your machine here. If you get a response with a version number, great you are all set. To check, in RStudio, click on the Terminal tab in the bottom-left panel (next to the Console tab). You might already have git installed on your computer, especially if you have a Mac. ![]() And once your projects are publicly available on Github (a website for hosting git repositories), there are a host of ways that folks can collaborate with you. There is a huge community built up around it. Git is also a very useful way for people to collaborate. All of your (committed) changes to your project are preserved, even when you make new changes or you revert old changes. First, when you use git, you are much less likely to encounter a devastating data failure. There’s a lot to git and it will be harder to use in the beginning, but in the long term there are huge benefits of it. ![]() It allows you to maintain a history of edits to your code without having to resort to a set of files like: my_code.R Git is a version control program that helps organize the process of writing and maintaining code. Install.packages( 'tinytex') tinytex :: install_tinytex() # install TinyTeX Installing and configuring git Unless you see the word Error you should be fine.) Those are usually just messages telling you information about the packages you are installing. (Don’t be worried if you see some red text here. Note that the symbols next to my_package are a less than sign < followed by a minus sign - with no space between them. If you are asked if you want to install any packages from source, type “no”. Make sure you do this separately for each line. To do this, either type or copy and paste each of the following lines of code into the “Console” in RStudio (lower left panel by default). ![]() Install the packages we will use throughout the semester.It makes working with R considerably easier and is available for most platforms. RStudio is a type of “integrated development environment” or IDE designed for R. With R installed, download and install RStudio.On a Mac, you will want to install using the R-x.y.z.pkg file that is notarized and signed. On a Windows machine, you will want to install using the R-x.y.z-win.exe file where x.y.z is a version number. There are versions available for the Windows, Mac, and Linux operating systems. Download and install the most recent version of R.In this problem set, we’re going to get R, RStudio, and R Markdown set up on your computer. Go to Fall 2023 site Installing R and RStudio
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |