Closed pdiakumis closed 10 months ago
Figured this one out through a separate issue. From https://yihui.org/en/2017/06/top-level-r-expressions/
The if function returns the value of a last expression depending on the condition. For example,
if (TRUE) A else B
returns A, andif (FALSE) {A} else {B; C}
returns C. With that in mind, you will understand why the ggplot object is not displayed in the if statement below:
library(ggplot2)
if (TRUE) {
ggplot(mpg, aes(cty, hwy)) + geom_point()
1 + 1 # the value of this expression is returned (and printed)
}
Fixes #132. This actually took me a ridiculous amount of time to figure out. And I'm not even sure why the DT doesn't render with the
rm
afterwards. Anyway, works now!