inst/tests/hamletSpeeches.R

require(XRPython)
parse <- PythonFunction("parse", "xml.etree.ElementTree")
setwd(system.file(package = "shakespeare"))
hamlet <- parse("./plays/hamlet.xml")
ev <- RPython()
ev$AddToPath(system.file("python", package = "shakespeare"))
getSpeeches <- PythonFunction("getSpeeches", "thePlay")
Speech <- setPythonClass("Speech", "thePlay")
speeches <- getSpeeches(hamlet)
speeches

Try the XRPython package in your browser

Any scripts or data that you put into this service are public.

XRPython documentation built on May 2, 2019, 9:33 a.m.