I'm writing a teaching document, in which I would like to hide some function and variable names, so the students have to rewrite themselves, but I still want to display the correct result. For example, this would be one code chunk:
# print 1+1
x <- 1 + ___
___(x)
#> 2
One solution that works is to write two code chunks:
```{r eval=FALSE}
# print 1+1
x <- 1 + ___
___(x)
```
```{r echo=FALSE}
# print 1+1
x <- 1 + 1
print(x)
```
That way, the students see the content of first code chunk, and the results of the second one. This works, but is a bit unpractical with tens of code chunks.
I feel this should be a common thing to do, and there are probably better solutions available, but couldn't really find anything with the keywords I tried.