Below are a set of tasks that we will work on in class (either alone
or in small groups).
Write a script that reads in data, calculates a statistic, and makes
a plot.
Full
Description Preview
Readings & Tasks
Tasks
Create a new R script in RStudio (File->New File->R
Script)
Save this file somewhere you will find it later
In your new script, load the iris dataset with
data(iris)
Read the help file for the function that calculates the mean (you
can run ?mean
or use the GUI).
Calculate the mean of the Petal.Length
field and save
it as an object named petal_length_mean
Plot the distribution of the Petal.Length
column as a
histogram (?hist
)
Save the script
Click ‘Source’ in RStudio to run your script from beginning to
end
Tasks
Read the course syllabus and make sure
you understand our class routine and grading
Install R on your computer from here if you haven’t already installed it.
Install RStudio Desktop (free version) on your computer from this source
Join the Slack Channel by following the link sent via email (ask if
you did not receive this link)
Join our DataCamp class following the link sent via email. Start
working on the first assignment (try to finish by Thursday)
Create a GitHub account and submit your github username to the
form sent to your email. This username may follow you for years, use
something professional that you will want to share with your future
employer.
Tasks
Create a new R script in RStudio
Load data from a comma-separated-values formatted text file hosted
on a website
Graph the annual mean temperature in June, July and August
(JJA
) using ggplot
Add a smooth line with geom_smooth()
Add informative axis labels using xlab()
and
ylab()
including units
Add a graph title with ggtitle()
Save a graphic to a png file using png()
and
dev.off()
OR ggsave
Save the script
Click ‘Source’ in RStudio to run the script from beginning to end to
re-run the entire process
Data wrangling plus more advanced ggplot
Full
Description Preview
Readings & Tasks
Tasks
Recreate layered graphics with ggplot including raw and transformed
data
Save graphical output as a .png file
Save your script as a .R or .Rmd in your course repository
Start using Github to manage course materials
Full
Description Preview
Readings & Tasks
Tasks
Watch the Git GUI
Install git
on your computer
Configure Git
Make sure git works in R-Studio (do you see the Git tab in the upper
right?)
Optionally sign up for the GitHub Education pack
Click on this link
to create a repository for your case studies
Set up it
credentials following this
Create a new project in Rstudio and connect it to the new repository
in GitHub. Helpful instructions are here
Make some change. For example, you could edit the README.md file in
your repository to include a brief description of the repository
(e.g. “Coursework for Spatial Data Science”).
Stage and Commit your changes to Git (using the git tab in the upper
right of RStudio)
Push the repository up to GitHub
Confirm that the changes are visible on your github webpage
Copy the contents of your scripts from previous weeks into the
appropriate files (but don’t edit the file names!)
Tasks
Join two datasets using a common column
Answer a question that requires understanding how multiple tables
are related
Save your script as a .R or .Rmd in your course repository
Tasks
Confirm that all tasks and case studies you have completed have been
committed in your course repository and pushed to Github.
Look ahead at Task 6 (Project Proposal) and start thinking about
possibilities
Post at least one rough project idea (with links, etc.).
Working with Spatial Data and the sf package
Full
Description Preview
Readings & Tasks
Tasks
Reproject spatial data using st_transform()
Perform spatial operations on spatial data (e.g. intersection and
buffering)
Generate a polygon that includes all land in NY that is within 10km
of the Canadian border and calculate the area
Save your script as a .R or .Rmd in your course repository
Vector data processing. Integrating ‘traditional GIS’ analyses with
statistical modelling. Data intersection, overlays, zonal statistics
Full
Description Preview
Readings & Tasks
Tasks
Keep thinking about your projects!
Use sf and terra to process raster data to quantify mean annual
temperature for each country and then identify the hottest one on each
continent.
Full
Description Preview
Readings & Tasks
Readings
Raster Vector Interactions GCR
Tasks
Calculate annual mean temperatures from a monthly spatio-temporal
dataset
Summarize raster values within polygons
Generate a summary figure and table.
Save your script as a .R or .Rmd in your course repository
Tasks
Take 10 deep breaths. You are doing ok!
Tasks
Learn how to read R help files effectively
Learn how to search for help
Learn how to create a Minimum Working Example (MWE)
Debug existing code
Post your reprex as an ‘issue’ in github
Post your repex to slack
Tasks
Write your project proposal in a .qmd file
Compile the .qmd to .md using the “render” button
Push both the .qmd and .md to Github
Upload the file to UBlearns and post links to your project proposal
.md file on slack.
Quarto to create dynamic research outputs. Publishing to
github/word/html/etc
Full
Description Preview
Readings & Tasks
Tasks
Build a Quarto document that downloads a dataset, produces one graph
and one table, and exports to four different formats (HTML, GitHub
Markdown, Word, Powerpoint).
Data I/O. RMarkdown to create dynamic research outputs. Publishing to
github/word/html/etc
Full
Description Preview
Readings & Tasks
Tasks
Create repository for final project
Explore various options for your project website
Push changes back to GitHub
Enable website on GitHub
Analyze historical storm data from NOAA
Full
Description Preview
Readings & Tasks
Tasks
Write a .Rmd script to perform the following tasks
Intersect the storms with US states to quantify how many storms in
the database have hit each state.
Processing daily weather data from NOAA
Full
Description Preview
Readings & Tasks
Tasks
Complete the Case Study for this week.
## Readings
Tasks
Extract a timeseries from a single location in a netcdf file (part
1)
Calculate a monthly climatology from a weekely timeseries (part
2)
Summarize Land Surface Temperature by Land Cover (part 3)
Tasks
Look through this week’s case study processing
MODIS RS data
Take notes on interesting or useful things you learned in your
course repository.
Keep working on your project!
Tasks
Download spatial data from the U.S. Census
Write a parallel foreach()
loop to generate a point
representing each person in each census polygon (block/tract)
Set the output of the foreach()
funtion to return a
spatial (sf
) object
Make a ‘dot map’ of the racial distribution in Buffalo, NY.
Submit the first draft of your project for peer review
Full
Description Preview
Readings & Tasks
Tasks
Commit your first draft of your project to GitHub
Tasks
Download daily weather data for Buffalo, NY using an API
Generate a dynamic html visualization of the timeseries.
Save the graph to your project folder using Export->Save as
Webpage
Tasks
Review at least two other students’ projects and make comments via a
pull request in GitHub.
Tasks
Bring any questions to class on Tuesday.
Tasks
Continue working on final project
Finish any remaining DataCamp courses
Ask questions!
Start working on your Grade Request Letter
Tasks
Commit second (or final) version of final project to GitHub
Prepare to give your 5 minute presentation
Present your analysis to your roommates, significant other, etc. and
update your presentation based on the feedback
Get feedback from 2-3 fellow classmates on your presentation and
update it based on their feedback
Give your 5 minute presentation in class
Commit the final version of your project
Full
Description Preview
Readings & Tasks
## Readings
Tasks
Finalize your project and commit to GitHub
Confirm the final version renders correctly on your website
Commit the final version of your project
Full
Description Preview
Readings & Tasks
## Readings
Tasks
Finalize your project and commit to GitHub
Confirm the final version renders correctly on your website