This article describes how to use the Code panel in Displayr to create and modify R-based Variables and Calculations in your Document. Note that R-based Data Sets do not use the Code Editor panel; for guidance, see below.
Accessing R code for R Data Sets
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, R variable, or R data set.
Accessing the R Code Panel
When you create a new R item, the Code panel will automatically appear below the page:
Otherwise, to access the Code panel for Variables and Calculations:
Method 1 - From the Properties panel:
- Select the object that contains R code (see above requirements).
- From Properties
, go to the Data tab and click Show advanced options if the R Code section is not expanded.
- In the R Code section, click Edit Code or hit F2 on your keyboard.
Method 2 - From the floating toolbar buttons on an object:
- Click the Code icon in the floating toolbar directly above or below the calculation when selected.
Closing the R code panel
When you are finished editing the R code in a calculation, you can manually close the panel 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 Properties
.
- By clicking the
icon in the floating toolbar that appears directly above or below the selected item.
Resizing the R code panel
You can adjust the code 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.
Accessing R code for R Data Sets
The code for an R Data Set:
- In the Data Sources pane, select the R data set name.
- In the Properties
, click Update.
- A dialogue with a field for the name of your data set and a code editor will pop up.