If needed, install Stylo (reference documentation https://sites.google.com/site/computationalstylistics/stylo):
install.packages("stylo", repos="https://cloud.r-project.org")
If needed, import a new corpus into TXM:
Load the stylo package into TXM:
library(stylo)
Now, let's use Stylo:
stylo(frequencies=t(subset(Index1$data, select= -F)), relative.frequencies=F)
Remark: You can also directly modify 'Index1' value before giving it to stylo Index1$data <- subset(Index1$data, select= -F)
then stylo(frequencies=t(Index1$data), relative.frequencies=F)
By default, R graphics generated by Stylo are displayed in an external window and frozen (). To display Stylo graphics into usual TXM windows, you can embed the R code calling Stylo in a Groovy script managing the R device for you.
To execute the same Stylo script as before but with graphics managed by TXM:
import org.txm.stat.engine.r.RWorkspace import org.txm.rcpapplication.commands.* 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(Index1\$data, select= -F)), relative.frequencies=F)") // open a new window to display the graphics monitor.syncExec(new Runnable() { @Override public void run() { OpenSVGGraph.OpenSVGFile(f.getAbsolutePath(), "stylo plot") } }); // stop logging R output r.setLog(false)