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 Nov. 17, 2017, 7:09 a.m.