Although the vast majority of calculations that need to be done can be done using standard options available in menus, Displayr also allows the user to create custom calculations.
Migrate Data Sets and Variable Code into a calculation
Custom code can be used:
- In calculations
- In variables
- To add data sets.
If you have wanting to check custom code for creating variables or adding data sets, it's a good idea to copy any R code from either of these into a new calculation and proceed with the checking, as calculations have more tools for checking for problems.
Check that Automatic calculation is checked
Calculations only automatically calculate if the Automatic option is checked. Remember that you need to check both that the calculation itself is set to automatic and also that any calculations that are inputs to the calculation are also set to Automatic.
Review any warnings
Calculations can show warnings. If a page contains any calculations with warnings, this is shown in the Pages tree. When you click on a calculation, the warnings are shown in the top right.
Sometimes the warnings are a bit hard to understand. If you cannot figure it out, please:
- Search through Displayr help.
- Do a general search on the internet (e.g., using Google).
- Contact email@example.com.
Hover over any functions in the R CODE
You can hover over functions in the code to see the documentation for the function For example, the documentation below has been obtained by hovering over sapply.
Use Show raw R output
By default, Displayr only shows the final result of a calculation. However, you can see more information by checking Properties > OUTPUT > Show raw R output (see the very bottom of the image below).
For example, as shown below, the warning that appears in the previous section is occurring after line 14 of the code has been run.
Using the print function with Show raw R output
As shown in the simple example below, when we use Show raw R output we can use print to show intermediate results on the screen. (The reason for using print(C) rather than just C, is that print(C) will also work if used within a function.)
Understand how Displayr does things a bit differently
Displayr is different from other programs for analyzing data. It has concepts that don't exist in other programs (e.g., variable sets), and it does other things a bit differently as well. This can lead to custom code giving different results to those that are expected. For more information, see:
- What To Do When a Result Looks Wrong
- What To Do When Displayr's Result is Different To Another Program's
- How R Works Differently in Displayr Compared to Other Programs