Exploratory Community

How to show the max value in a certain column as a text in Note


Suppose you have sales data. Each row represents an order. Now, you want to show the max sales amount per order as a text in the note like “The max sales amount per order is $xxxx”. Here is how.

First, check the data frame name and column name you want to show.

Then, open a note and write an R expression to get the max value. You can refer a column in the following syntax.

(data frame name)$(column name)

In this case, it will be


Once you are done with the R expression, surround the expression with “`r” and “`” like following.

`r max(Global_Sales$Sales)`

This portion will be evaluated and replaced with the output in the final document. You can hit the Refresh button to see the output.