~/talk

How to Run Your Favorite Python Package in R

Talkat PyOhio 2020 · 2020-07-25..07-26· [python, data-science]
slides:none on file

Shows exactly how to embed Python into R using reticulate and a Python virtualenv called tweetenv, setting R to use Python 3.7 and pip installing requests. Uses a YAML secret file to load a bearer token, builds a Python header dict via json.loads, calls Twitter Labs recent search for the past seven days, receives JSON, converts it with jsonlite flattening, and pipes into dplyr to select tweet id and text, returning the default last 10 tweets for inspection.

AI-written summary · about

  1. 0:00Start
  2. 0:05Running your favorite Python package inside of R
  3. 0:48Reticulate is a package for R that allows you to run Python code inside of R.
  4. 1:54The search-tweets-python example
  5. 2:55I'll be using the Python Requests package to make an http request to call the recent search endpoint
  6. 3:11Recent search allows you to get Tweets from the past seven days.
  7. 3:42You will also need to enroll in the preview for Labs recent search.
  8. 9:34If you are building with the Twitter API, I'd love to have a conversation.
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.