If needed, install the Stylo R package into the R of TXM:
(Stylo must be installed in the TXM-hosted R in order to be applied to TXM-created tables)
[reference documentation of Stylo installation : stylo: R package for stylometric analyses]
install.packages("stylo")
[/usr/lib/TXM-0.8.3beta/../../../home/sheiden/.TXM-0.8.3/plugins/org.txm.statsengine.r.core.linux_1.0.0.202305171515/res/linux64/bin/R
in this screenshot]
..bin/Rcmd: 64: exec: INSTALL: not found
chmod +x /usr/lib/TXM-0.8.3beta/.../res/linux64/bin/*
If needed, import a new corpus into TXM:
Load the stylo package into TXM:
library(stylo)
By default, R graphics generated by Stylo are displayed in an external window and frozen (you can't zoom or pan in it).
To display Stylo graphics into usual TXM windows, you embed the R code calling Stylo in a Groovy script managing the R devices for you.
TXM macros are Groovy scripts easy to create and to call.
import org.txm.statsengine.r.core.RWorkspace import org.txm.rcpapplication.commands.* import org.txm.rcp.commands.OpenBrowser def r = RWorkspace.getRWorkspaceInstance() // start logging R output in the console r.setLog(true) // use a temporary file to save the graphic def f = File.createTempFile("txm", ".svg") // execute R code generating the graphics in a SVG device r.plot(f, "stylo(frequencies=t(subset(PartitionIndex1\$data, select= -F)), relative.frequencies=F)") println "Plot saved in ${f.getAbsolutePath()}" // open a new window to display the graphics monitor.syncExec(new Runnable() { @Override public void run() { OpenBrowser.openfile(f.getAbsolutePath(), "stylo plot") } }) // stop logging R output r.setLog(false)