# Submit Commands

StatET allows easy interaction with an R console: chunks of code can be submitted by means of simple keyboard shortcuts. The following paragraphs detail some individual submit actions that are part of the StatET R editor.

For some of the listed commands there is the variant ".. and Goto To Console". These set the focus to the R console after the code is submitted. If available, the default keyboard shortcut for these commands is the second variant in the table.

| Name | Description | Availability
--- | --- | --- | ---
Whole file The menu items for this commands can be found in the context menu of the R editor in the submenu Run As.
| Run R-Script in R submitting directly | ... | `Ctrl+R, Ctrl+D` `Ctrl+R, D`

Run File in R via Command /
Run R-Script via 'source' in R

When editing an R script, this command sources in the entire file.

One can also run this command from the Navigator view for a selected R script file. The generic "Run File in R via Command" works also for other files. The R command depends on the content type (e.g. `Sweave(...)` for Sweave files) and is customizable in the preferences.

`Ctrl+R, Ctrl+S`
`Ctrl+R, S`

Selection based
| Run Selection in R / Run Selection/Current Line in R | In text editors, this command submits the selected code to R. If no text is selected, it sends the current line to R. | `Ctrl+R, Ctrl+R` `Ctrl+R, R`
| Run Selection in R and Go to Next Line | This command submits the selected code or the current line to R and moves the cursor to the next line in the text editor. Consecutively repeating this command sends the R script line by line. | `Ctrl+R, Ctrl+4`
| Run Entire Command in R | Submits the entire R command(s) around the current the selection. Entire R command means the complete expression at top level of the script or in a block `{ }`. | `Ctrl+R, Ctrl+E` `Ctrl+R, E`
| Run Entire Command in R and Go to Next Command | This submits the entire R command to R and moves the cursor to the beginning of the next R command. Consecutively repeating this command sends the code in steps of complete statements to R. | `Ctrl+R, Ctrl+3`
| Run Function Definition in R | When the cursor is inside a function definition, it is possible to submit the entire function using this command. This comes of course very handy when one operates small changes to a function definition and wants to quickly test the use of the newly changed function. | `Ctrl+R, Ctrl+F` `Ctrl+R, F`
Special
| Submit and Paste Results (simple R worksheet) | This command submits the selected block of R statements and directly paste the R output into the script file using. | `Ctrl+R, Ctrl+V` `Ctrl+R, V`

#### Print variable value to console

When the cursor is on the name of a given variable, it is possible to print the value of the variable to the console. The default keyboard shortcuts for this command are `Ctrl+R Ctrl+P` `Ctrl-R P`

#### Toggle Echo

The toggle command allows to switch echo on/off when using Run File in R via Command. By default it toggles echoing of input lines when sourcing a R file. It can be adapted by configuring the file commands in the preferences.