Clone assignment repo

  1. Go to your repo appex02-[github_name] on GitHub.

  2. Click on the green Clone or download button, select Use HTTPS (this might already be selected by default, and if it is, you’ll see the text Clone with HTTPS as in the image below). Click on the clipboard icon to copy the repo URL.

  3. Go to RStudio Cloud and into the STA 199 course workspace. Create a New Project from Git Repo. You will need to click on the down arrow next to the New Project button to see this option.

  4. Copy and paste the URL of your assignment repo (done in step 2) into the dialog box.

  5. Click OK, and you should see the contents from your GitHub repo in the Files pane in RStudio.

Configure git

Type the following lines of code in the Console in RStudio - filling in your name and email address.

library(usethis)
use_git_config(user.name="your name", user.email="your email")

For example, mine would be

library(usethis)
use_git_config(user.name="Shawn Santo", user.email="shawn.santo@duke.edu")

RStudio and GitHub can now communicate with each other and you are ready to do the exercise below!

Some ggplot2 practice

  1. Modify the following plot to change the color of all points to a color of your choice. Adjust the figure width size and height as you see fit.
ggplot(data = starwars, 
       mapping = aes(x = height, y = mass, color = gender, size = birth_year)) +
  geom_point(color = "#30509C") +
  labs(title = "_____" , size = "_____", x = "_____", y = "_____")
## Warning: Removed 51 rows containing missing values (geom_point).

  1. Add labels for title, x and y axes, and size of points. Knit again.

  2. Try to create a histogram for the variable mass in starwars. Put your code in the chunk below.

Stage, commit and push

  1. Stage your modified Rmd file.
  2. Commit your changes with message: “complete plots”
  3. Push your changes to your GitHub repo.
  4. Verify your files were updated on GitHub.

You will go over all of these steps again in tomorrow’s lab

References

  1. SWAPI - The Star Wars API . (2020). Swapi.co. Retrieved from https://swapi.co/