Using Python & R in Harmony
summary
Shows live use of reticulate to run Python (requests, pandas) inside R and rpy2/py2r patterns to run R (forecast::auto.arima, ts, ggplot2) inside Python; demonstrates creating virtual Python environments, converting objects back and forth, and calling the weather.gov API for four stations (observed temperature variance ~20°F). Scrapes state population series with BeautifulSoup, forecasts 2020 with auto.arima, applies the Huntington‑Hill method to assign House seats, and predicts Ohio and California each lose one electoral vote.
AI-written summary · about
chapters (18)
- 0:00Intro
- 3:11Event: PyOhio 2019 Talk: Using Python & R in Harmony Date: July 27th, 2019
- 4:30What is reticulate?
- 5:03A brief guide to using reticulate within R
- 6:21Spinning up a Python virtualenv within R
- 7:28Importing Python modules within R
- 7:38Leveraging Python module functions
- 8:18An example with a web API & SF Bay climates
- 9:28Calling the weather gov web API
- 10:59Gathering JSON responses with help from Python
- 12:24Wrangling & stacking observations
- 14:14A brief guide to using rpy2 within Python
- 14:48Installing and Importing rpy2
- 15:34Executing an R Script
- 17:32Estimating Electoral College Votes by State
- 17:58Scraping State Population Data
- 18:38Using R Functions, Generate Forecasts
- 19:49Assigning House Seats
related talks
35mEffective Python and R collaboration
32mInterfacing R and Python
18mYes, you can use Python with RStudio Team!
10mHow to Run Your Favorite Python Package in R
37mRewriting your R analysis code in Python
18mYes, you can use Python with RStudio Team!
16mR, Python, and Tableau: A Love Triangle
17mPolyglot Data Science: Why and How to Combine R and Python
