Why does {learnr} output 'Last value being used to check answer is invisible'?

When checking a correct answer with {gradethis} in a {learnr} tutorial, I'm unsure why the following gets printed after clicking 'Submit Answer':

Last value being used to check answer is invisible. See ?invisible for more information.

I'm not sure why this prints; I do not understand the content of ?invisible in this context. I think I've misunderstood how to use {gradethis}. Any ideas?

This is a screen shot:

Here's the contents of my {learnr} .Rmd file:

---
title: "Tutorial"
output: learnr::tutorial
runtime: shiny_prerendered
---

```{r setup, include=FALSE}
library(gradethis)
library(learnr)
tutorial_options(exercise.checker = gradethis::grade_learnr)
knitr::opts_chunk$set(echo = FALSE)
```

Type "Hello" between the quotation marks.

```{r hello, exercise = TRUE}
print("")
```

```{r hello-check}
grade_result(
  pass_if(~identical(.result, "Hello"), "That is correct.")
)
```

And here's the session info:

─ Session info ──────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       macOS Sierra 10.12.6        
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_GB.UTF-8                 
 ctype    en_GB.UTF-8                 
 tz       Europe/London               
 date     2020-02-02                  

─ Packages ──────────────────────────────────────────────────────────────────────────────────
 package     * version    date       lib source                                      
 assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                              
 backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.0)                              
 cli           2.0.1      2020-01-08 [1] CRAN (R 3.6.0)                              
 crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                              
 digest        0.6.23     2019-11-23 [1] CRAN (R 3.6.0)                              
 evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                              
 fansi         0.4.1      2020-01-08 [1] CRAN (R 3.6.0)                              
 fastmap       1.0.1      2019-10-08 [1] CRAN (R 3.6.0)                              
 glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                              
 gradethis   * 0.1.0.9002 2020-02-02 [1] Github (rstudio-education/gradethis@a310ca9)
 htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.0)                              
 htmlwidgets   1.5.1      2019-10-08 [1] CRAN (R 3.6.0)                              
 httpuv        1.5.2      2019-09-11 [1] CRAN (R 3.6.0)                              
 jsonlite      1.6        2018-12-07 [1] CRAN (R 3.6.0)                              
 knitr         1.26       2019-11-12 [1] CRAN (R 3.6.0)                              
 later         1.0.0      2019-10-04 [1] CRAN (R 3.6.0)                              
 learnr      * 0.10.0     2019-11-09 [1] CRAN (R 3.6.0)                              
 magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.0)                              
 markdown      1.1        2019-08-07 [1] CRAN (R 3.6.0)                              
 mime          0.8        2019-12-19 [1] CRAN (R 3.6.0)                              
 promises      1.1.0      2019-10-04 [1] CRAN (R 3.6.0)                              
 R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.0)                              
 Rcpp          1.0.3      2019-11-08 [1] CRAN (R 3.6.0)                              
 rlang         0.4.4      2020-01-28 [1] CRAN (R 3.6.1)                              
 rmarkdown     2.0        2019-12-12 [1] CRAN (R 3.6.0)                              
 rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)                              
 rstudioapi    0.10       2019-03-19 [1] CRAN (R 3.6.0)                              
 sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                              
 shiny         1.4.0      2019-10-10 [1] CRAN (R 3.6.0)                              
 withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                              
 xfun          0.12       2020-01-13 [1] CRAN (R 3.6.0)                              
 xtable        1.8-4      2019-04-21 [1] CRAN (R 3.6.0)                              
 yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                              

[1] /Users/matt.dray/Library/R/3.6/library
[2] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

I recently stumbled upon this myself. We're tracking this issue at https://github.com/rstudio/learnr/issues/369. So, no quick fix, but hopefully soon!

1 Like