If you put the expression in parentheses, the result will be printed:
(n <- 3)
#
This works because the assignment operator <-returns a value (invisible, which is strange not in the documentation). Putting it in parentheses (either in printor c, or show, or cat(without a new line)) makes it visible.
source
share