This article describes how to use the R code editor in Displayr.
Requirements
A Displayr document with at least one of the following:
- An existing object that is built using R code,
- An object that contains R code, or
- A new custom calculation.
Accessing the R code editor
- Select an object that contains R code (see above requirements).
- From the object inspector, go to Data > R Code > Edit Code, hit F2 on your keyboard, or click the Edit(F2) badge just above the object you've selected.
When a calculation is first inserted, the R code editor panel will automatically appear at the top of the page:
To re-enter a closed R code editor, you can either repeat option 2 above or else click the middle icon in the toolbar directly above the calculation when selected.
Closing the R code editor
If you click out of the calculation or deselect it, the R code editor panel will close automatically.
When you are finished editing the R code in a calculation, you can manually close the editor in one of the following ways:
- By using the X button in the upper right corner of the editor.
- By using the Hide Code button in the object inspector.
- By using clicking the middle icon in the toolbar that appears directly below the selected item.
Pinning the R code editor
You also have the option to pin the editor panel to the top of the page by clicking on the pin button in the upper right corner of the editor. Once pinned, the editor will not close, even if you select another object that's not supported by the R code editor.
If the R code editor is pinned and you select an object that's not supported or click on the page, the panel will display a message that indicates that you need to select a custom calculation to edit its R code:
Resizing and Maximizing the R code editor
You can adjust the code editor panel's height by dragging the panel up or down. The height is remembered as long as you do not clear your browsing data/cache for Displayr.
To instead maximize your view, you can click the left icon on the toolbar that appears directly above or below your selected output.
And you can exit from this view by clicking the Exit Maximized View button at the top right.
Next
How to Add a Custom Calculation