Skip to content

Latest commit

 

History

History
78 lines (51 loc) · 4.06 KB

README.md

File metadata and controls

78 lines (51 loc) · 4.06 KB

Introduction to R + OSM

This is a workshop put together by Angela Li of the Center for Spatial Data Science (CSDS) at UChicago for State of the Map 2018.

Learning Objectives

By the end of this workshop, workshop attendees should be able to:

  1. Install useful R packages
  2. Download OSM data from the OpenStreetMap API, using the osmdata R package
  3. Map downloaded OSM data in R
  4. Understand the two formats in which R stores spatial data

⭐️ Do This Now! ⭐️

Install Necessary Packages

Open RStudio and paste the following code into your console, then press Enter to run it:

# Download packages from CRAN
install.packages(c("devtools", "knitr", "magrittr", "sf", "sp", "rmarkdown", "usethis", "osmdata"))

Download Lesson Materials

Download this entire lesson (all code, notebooks, and data) to your computer desktop by running the following code in your RStudio console. Respond yes to all prompts:

usethis::use_course("https://github.com/angela-li/sotmus-r/archive/master.zip")

Once you've downloaded this lesson, open the .Rproj file to get started.

Use the sotmus-r-complete.Rmd notebook as a guide to fill out the sotmus-r.Rmd lesson notebook.

Contents

  • code: Raw R code generated from notebooks
  • data: Intermediate R data objects (to be used in case of bad Internet connection)
  • notebooks: R Markdown notebooks with R code, produced during workshop. Includes empty notebook (sotmus-r.html) and filled-out notebook (sotmus-r-complete.html).
  • slides: Intro slides (there are only 2 because I worked live in the sotmus-r.Rmd notebook)

Troubleshooting

If you're running into issues with RTools (mostly Windows users), check out this solution on Github.

Typing ? before your R command in the console will bring up function documentation in R.

Contact Me

Feel free to email me at [email protected] or reach out on Twitter for questions! Or submit a Github Issue on this page for problems.

Additional Resources

References

Thanks to Mark Padgham and rOpenSci for maintaining the osmdata package!

Thanks to Jared Lander, Chris Prener, Jenny Bryan, Software Carpentry, and RStudio Education for informing the design of this workshop repository. In the same vein, please feel free to use this workshop as a template for your own R workshop. (If you do, give me a hoot!)

Note: For exporting xaringan slides to a PDF, I used the webshot package, instructions for which are found in the xaringan wiki.