How to use pymovements in R#

Install the R-package reticulate for interoperability between Python and R.

install.packages("reticulate")

Load the package.

library(reticulate)

Install pymovements, if you haven’t yet.

py_install("pymovements")

Import pymovements as pm.

pm <- import("pymovements")

Now pymovements should appear as pm under values in your environment

Access functions and data within python modules and classes via the $ operator

To test, you can proceed with the “pymovements in 10 minutes” tutorial, for example this is how you download the ToyDataset:

dataset = pm$Dataset('ToyDataset', path='data/ToyDataset')
dataset$download()

Now let’s load in the dataset into R and display the found files:

dataset$load()
dataset$fileinfo