Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with encoder #9

Open
ghost opened this issue Sep 23, 2020 · 6 comments
Open

Problems with encoder #9

ghost opened this issue Sep 23, 2020 · 6 comments

Comments

@ghost
Copy link

ghost commented Sep 23, 2020

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()
@mine-cetinkaya-rundel
Copy link

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.

@ghost
Copy link
Author

ghost commented Sep 27, 2020

`---
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()

`

@ghost
Copy link
Author

ghost commented Sep 27, 2020

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.

image

@mine-cetinkaya-rundel
Copy link

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()
    ```

@ghost
Copy link
Author

ghost commented Sep 29, 2020

makes sense, @mine-cetinkaya-rundel ! I didn't remember that it was encoding the answers...

@rundel
Copy link
Owner

rundel commented Dec 8, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants