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
- An R-based Calculation output, R variable, or R data set. Note that some variables and outputs created automatically via the menus are R-based.
Accessing the R Code Panel
On creation of custom items
When you create a new custom R-based variable or Calculation, the Code panel will automatically appear below the page:
Via the Properties
You can view the R code of any R-based variable or output (regardless if it is a custom one or one created via a menu item) through the Properties panel.
- Select the object that contains R code.
- From Properties
, click Data > Attributes > Code. Note, if the item does not have Attributes > Code listed in the Properties, it is not R-based and the underlying code cannot be accessed.
Via the floating toolbar
If you select a Calculation > Custom Code output or custom R variable, click on the Code icon in the floating toolbar.
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 Code
panel.
- By pressing the Code button in Properties
> Data > Attributes.
- 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's name.
- From the floating toolbar, click Update
.
- A dialog with a field for the name of your data set and a code editor will pop up.