Getting Started

HES 505 Fall 2023: Session 1

Matt Williamson

Welcome to Space!!

Today’s Plan

  • Introductions

  • Why (not) R?

  • Course logistics and resources

  • Testing out RStudio, git, and GitHub Classroom

Introductions

About Me

  • What I do

  • My path to this point

  • Why I teach this course

What about you?

  • Your preferred pronouns

  • Where are you from?

  • What do you like most about Boise?

  • What do you miss most about “home”?

  • What is your research?

Why (not) R?

Why R?

  • Open Source

  • Huge useR community

  • Integrated analysis pipelines

  • Reproducible workflows

library(maps)
library(socviz)
library(tidyverse)
party_colors <- c("#2E74C0", "#CB454A") 
us_states <- map_data("state")
election$region <- tolower(election$state)
us_states_elec <- left_join(us_states, election)
p0 <- ggplot(data = us_states_elec,
             mapping = aes(x = long, y = lat,
                           group = group, 
                           fill = party))
p1 <- p0 + geom_polygon(color = "gray90", 
                        size = 0.1) +
    coord_map(projection = "albers", 
              lat0 = 39, lat1 = 45) 
p2 <- p1 + scale_fill_manual(values = party_colors) +
    labs(title = "Election Results 2016", 
         fill = NULL)

Why not R?

## ---
## Error: could not find function "performance"
## ---
##  [1] "Error in if (str_count(string = f[[j]], 
##  pattern = \"\\\\S+\") == 1) 
##  { : \n  argument is of length zero"   
## ---
## Error in eval(expr, envir, enclos) : object 'x' not found
## ---
## Error in file(file, "rt") : cannot open the connection
## ---
  • Coding can be hard…

  • Memory challenges

  • Speed

  • Decision fatigue

Getting Help

  • Google it!!
    • Use the exact error message
    • Include the package name
    • include “R” in the search
  • Stack Overflow
    • Reproducible examples
  • Package “issue” pages
  • r_spatial slack channel
  • Common errors

Ask Me

Class Details

Logistics

  • Meet on Mondays and Wednesdays

  • ~55 min lecture, 20 min practice

  • 4 major sections

  • Readings

Course Webpage

https://isdrfall23.classes.spaseslab.com/

  • Syllabus

  • Schedule

  • Lectures

  • Assignments

  • Resources

Assignments

Check out the syllabus for more on grading!

  • Self-reflections (2x)
    • Your goals for the course
    • Evaluation criteria
  • Coding exercises (10x)
    • Problem solving
    • Reproducible workflows
    • Muscle memory
  • Code Revisions (3x)
    • Digging deeper
    • Common issues
    • More extensive feedback
  • Final project (1st draft, final draft)
    • Practice a full analysis workflow
    • Integrate analysis & visuals to tell a story

Getting started

Orientation to RStudio and our RStudio server

Git and Github classroom

Introduce yourself to Git

  1. Lots of ways, but one easy way is:
library(usethis) #you may need to install this using install.packages('usethis')
use_git_config(user.name = "Jane Doe", user.email = "jane@example.org") #your info here
  1. Generate a PAT token if you don’t have one (make sure you save it somewhere)
usethis::create_github_token()

Introduce yourself to Git (cont’d)

  1. Store your credentials for use (times out after 1 hr)
gitcreds::gitcreds_set()
  1. Verify
gitcreds::gitcreds_get()

Joining the assignment and cloning the repo

  1. Click this link

  2. Bring the project into RStudio

  • Go to File>New Project and choose the “Version Control” option
  • Select “Git” (Not Subversion)
  • Paste the link from the “Clone Repository” button into the “Repository URL” space

The git workflow

  • Make sure to pull everytime you start working on a project

  • Make some changes to code

  • Save those changes

  • Commit your changes

  • Push your work to the remote!

Wrapup

Checking in

  1. What are some advantages and disadvantages of using R for spatial analysis

  2. What can I clarify about the course?

  3. How do you feel about git and github classroom? How can I make that easier for you?

End