learnrhash
learnrhash copied to clipboard
Problems with encoder
There seems to be a discrepancy between the help for encoder_ui() and what is stated on the github site (see below) about how to use it. In particular, the help in R for this package says we need to specify ui_before() and ui_after() etc. When I run the code below, I get a page long hash and no "COPY" button.
Submit
learnrhash::encoder_logic()
learnrhash::encoder_ui()
We removed the copy button since it wasn't working well on shinyapps.io (potentially due to security measures). However I just tried things out and the rest behave as expected. If you have a reproducible example with output you're seeing, I'd be happy to help figure out what might be going wrong.
`--- title: "A closer look at ggplot" tutorial: id: "edu.washington.stat.rstudio.01-ggplot-basics" version: 1.1 output: learnr::tutorial: progressive: true allow_skip: true
runtime: shiny_prerendered
knitr::opts_chunk$set(echo = FALSE)
#devtools::install_github("rundel/learnrhash")
library(learnr)
library(tidyverse)
library(learnrhash)
ggplot(data=iris,mapping=aes(x=Sepal.Width,y=Sepal.Length)) +
geom_point()+
facet_wrap(facets=vars(Species),nrow=1)
Wrap Up
Congratulations on making it through this very brisk introduction to ggplot! There is tons more you could do with ggplot; the key is to keep trying and learning.
learnrhash::encoder_logic()
learnrhash::encoder_ui()
`
When I run the above, I see the "Generate hash button" and when I click on it, I get a hash that goes on forever.
Thanks for the reprex @grover4!
I can reproduce this and have created an example that's a little more simple. It seems to me like learnrhash fails when the answer to an exercise is a plot. If you replace the exercise code with 1+1
or mtcars
learnrhash is able to encode the output properly.
---
title: "Minimal example"
output: learnr::tutorial
runtime: shiny_prerendered
---
```{r include = FALSE}
library(learnr)
library(learnrhash)
```
```{r ex, exercise = TRUE}
plot(cars)
```
```{r context = "server"}
learnrhash::encoder_logic()
```
```{r echo = FALSE}
learnrhash::encoder_ui()
```
makes sense, @mine-cetinkaya-rundel ! I didn't remember that it was encoding the answers...
The newest version on github now has the strip_output
option for encoder_logic
which will remove any output (including plots) and this should help keep the hash sizes manageable.
I've also added select hash and copy hash buttons back to the encoder ui - they seem to be working well but testing is still a bit limited.