Integrating R with ArcGIS: Part 1
Getting Started with WebEx
- Listen to the audio broadcast:
- Phone
- Computer speakers
- To maximize your view of the Webinar, click:
- Click the blue arrow button to return to original view:
Open to Questions
- Please use the Chat panel:
- Choose Presenter, type your question and click Send
- If you are unable to see the Chat panel, click the Chat button on the top-right corner of your screen:
Webinar Schedule
- Introduction to R
- Development environments
- R basics
- Third party packages
- Data manipulation with dplyr
- The R-ArcGIS Bridge
- Installing the R-ArcGIS Bridge
- The arcgisbinding package
- Reading and writing data from geodatabases
- Visualization in ArcGIS Pro
R
What is R?
- Open programming language for statistical computing and data analysis
- Implementation of the S programming language developed at Bell Laboratories
- Active user community constantly contributing new packages
- Over 8000 packages available on the Comprehensive R Archive Network (CRAN)
Why use R?
- De facto standard language for statisticians
- Most state-of-the-art statistical methods implemented in packages available on CRAN
- Most state-of-the-art statistical methods implemented in packages available on CRAN
- One the fastest growing programming languages over the past ~5 years
- Powerful language for creating high quality plots and graphics
- base R plots, ggplot2, ggvis
Development Environments
-
RStudio
- Open source and enterprise-ready professional software for R
- Developed and maintained by team of reputable software engineers including Hadley Wickham
- Keep your work organized using RStudio projects
- Recently announced R Tools for Visual Studio
- Soon to be released, but can sign up for early access version
Getting Started with R
R Data Types
- R offers many of the conventional data types you may be used to using in other languages
-
numeric, integer, logical, character, list
-
- Several unique data types:
-
vector, data.frame, matrix, factor
-
Third Party Packages
- Many third party packages that extend the capabilities of base R
- Hadley stack
-
ggplot2, dplyr, stringr, tidyr, devtools
-
- Statistical modelling
-
car, lme4, caret, mgcv
-
- Spatial data
-
arcgisbinding, sp, maptools
-
- Time-series
-
zoo, xts, spacetime
-
- CRAN Task Views for categorized view of packages
The dplyr Package
- Package developed by Hadley Wickham to give users a fast, consistent tool for working with tabular data in R
- Improves on many of the base R methods for data frame manipulation
- Function for each basic verb of data manipulation:
-
filter, arrange, select, mutate, summarize
-
- Introduces the forward-pipe operator (i.e., %>%) for producing more intuitive workflows in R
crime_df %>%
filter(Equity_Score > 80) %>%
select(Neighbourhood, Thefts, Vehicle.Thefts) %>%
arrange(Thefts, Vehicle.Thefts)
R - ArcGIS Bridge
R - ArcGIS Bridge
- ArcGIS developers can create custom tools that integrate R with ArcGIS
- Allows R users to access their organization's GIS data managed in traditional GIS ways
- Create custom geoprocessing tools that are powered by R scripts
Installing the R - ArcGIS Bridge
- Navigate to the R-Bridge Install GitHub page and download the Python toolbox
- Before installing, ensure that you have the correct version of R and ArcGIS installed:
- R 3.1 or later
- ArcGIS Pro 1.1 or later (for 64-bit R)
- ArcGIS for Desktop 10.3.1 or later
- 32-bit R by default in Desktop
- 64-bit R available via ArcGIS for Server and background geoprocessing
- In future, will be able to use Conda to manage R environments
The arcgisbinding Package
- The arcgisbinding package allows R users to access data stored using ArcGIS native data types (e.g., geodatabase feature classes)
-
arc.open, arc.select, arc.write
-
- Convert ArcGIS data to an sp object, perform some analysis, and then write back to a geodatabase
-
arc.data2sp, arc.sp2data
-
- Convert between WKT and proj.4
-
arc.fromP4ToWkt, arc.fromWktToP4
-
- Interact with geometries
-
arc.shapeinfo, arc.shape2sp
-
- Package Documentation
Closing
Outreach
- Very interested in having other members of the R community contribute to the R - ArcGIS Bridge
- Sample tools available on GitHub
- Have questions? Contact us!
- Collaboration with R package developers
R Webinar Resources
- Download RStudio project and ArcGIS Pro project used during webinar:
Integrating R with ArcGIS: Part 2
- Quick review of arcgisbinding package
- Basic components of an R - ArcGIS script tool
- Writing a stand-alone R script that can be attached to an ArcGIS geoprocessing tool
- Constructing an R-ArcGIS script tool using ArcGIS Pro
- Using R-ArcGIS script tools in ModelBuilder workflows
Thanks
- R - ArcGIS Bridge Team at Esri US
- Shaun Walbridge, Mark Janikas, Steve Kopp, Dmitry Pavlushko, Konstantin Krivoruchko
- Hadley Wickham
- R spatial community
Contact Information
Integrating R with ArcGIS - Part 1
By Cam Plouffe
Integrating R with ArcGIS - Part 1
- 8,085