Submit R Script

Select menu: Run | Submit R Script

Use this to submit a set of commands to R and then read the output generated from the run back into Genstat.

To use this menu the R software must be installed on the current system and the location of R must be specified within the setup menu. To execute commands within R, Genstat creates an R script file (.r) that contains the commands for setting the working directory, loading any data and running additional R commands (supplied in another file or using the Edit R Script menu). By default, this file is executed in R using the Rterm.exe executable, however, the executable used can be changed via the setup menu. The script is executed within Genstat using the RXGENSTAT procedure.

Available Data

This lists data structures that can be exported to R. The dropdown list can be used to display the data structures within the available data list based on their type (e.g. variates, factors, scalars etc…). Double-click a name to copy it to the Data to export field or type the name. You can transfer multiple selections from Available Data by holding the CTRL key on your keyboard while selecting items, then click to move them all across in one action.

Data to export

Specifies data to be exported from Genstat to R. The data structures can either be a list of factors, variates and texts of equal length, a list of scalars, or a single matrix. When the script is run the data are first saved to an R data (rda) file using the EXPORT procedure. The name of this file should be supplied using the Export R Data file (rda) option and then the data can then be accessed within an R script. For example, if are data exported into a file called idata.rda, then within the R script the data can be accessed as idata$x etc…

Export R Data file (rda)

Specifies the name of the R data file that the Genstat data are to be exported into.

Working Directory

Sets the working directory for Genstat and R. Files located in this directory can be specified using just their names; files in other directories need to be specified using their full pathname.

R Script

Specifies the R script that is to be run.

R Script file Enter the name of an R script file (.r) containing the R script.
Specify R Commands Lets you enter the R script by clicking on the Edit R Script button.

Output File

Specifies a filename to save the output generated by R.

Import R Data file (rda)

Specifies the name of an R data file saved within the R script that contains data that are to be imported back into Genstat. The data are imported into Genstat using the IMPORT procedure and a pointer to this data can be saved using the Save pointer to import data option.

Save pointer to import data using

When selected, this provides the space to enter the name of an identifier to save as a pointer to the imported data.

R Setup

Opens a dialog where you can specify the location of the R executables and additional command line options for R.

Action Buttons

Run Submit the script to R.
Cancel Close the menu without further changes.
Options Opens a dialog where additional options and settings can be specified.
Defaults Set the menu settings back to the default settings. Clicking the right mouse on this button produces a pop-up menu where you can choose to set the options using the currently stored defaults or the Genstat default settings.

Action Icons

Pin Controls whether to keep the menu open when you click Run. When the pin is down , then the menu will remain open, otherwise when the pin is up , the menu will close.
Restore Restore names into edit fields and default settings.
Clear Clear all edit and list boxes.
Help Help about this menu.

See Also

Updated on November 29, 2017

Was this article helpful?