Git Product home page Git Product logo

tidyquiz's Introduction

tidyquiz

Project Status: Concept โ€“ Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept. Blog post

Can you match the tidyverse function to the package name? A multiple choice quiz hacked together with {learnr}.

Answering a question and geting a new one

What?

Can you always remember which tidyverse function comes from which tidyverse package? Inspired by frustrations of Ryan Timpe, Daniel McNichol, and others I'm sure.

The {learnr} package lets you build quizzes, obstensibly for learning about R. I wondered if you could use it to serve a randomised question about what function belongs to which tidyverse package. It's a bit hacky: you have to click the 'get question' button to begin and then 'start over' each time you want a new question.

You can read the accompanying blog post for more info on how it was built.

How to run

Install the package and run the app with the following commands:

  1. install.packages(c("remotes", "pacman", "tidyverse", "learnr")) to install {learnr} from CRAN (beware: this will install a lot of packages)
  2. remotes::install_github("matt-dray/tidyquiz") to install this package from GitHub
  3. learnr::run_tutorial("tidy", package = "tidyquiz") to open in your browser

The app is no longer hosted online.

Notes

Do I have to install loads of packages for this to work?

Yes, if installing locally. This thing works on the fly. It fetches the tidyverse packages and creates questions and answers whenever you run generate_quiz(). This means you should be prepared for all the tidyverse packages to be downloaded to your machine. On the plus side, functions presented to you in the quiz will always be current.

The list of packages can be found in tidyverse::tidyverse_packages(). At time of writing (2019-03-17) the packages are:

"broom"     "cli"         "crayon"   "dplyr"     "dbplyr"      "forcats"
"ggplot2"   "haven"       "hms"      "httr"      "jsonlite"    "lubridate"
"magrittr"  "modelr"      "purrr"    "readr"     "readxl"      "reprex"
"rlang"     "rstudioapi"  "rvest"    "stringr"   "tibble"      "tidyr"      
"xml2"      "tidyverse"  

What about functions that mask other functions?

There's only ever one correct answer from the four presented. If you are presented with a function that exists in multiple packages, the answer set will include one package it definitely exists in and three it definitely doesn't exist in.

tidyquiz's People

Contributors

matt-dray avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

tidyquiz's Issues

Try alternative to {learnr}

{shiny}: button to randomise questions; answer with radio buttons/check boxes and 'submit' button; final score tallied.

How about {swirlify}? Can users get a randomised list of questions?

Startup message doesn't appear on load

library(tidyverse)
#> Run `learnr::run_tutorial("tidy", package = "tidyquiz")` to start the quiz

Related to zzz.R. Maybe just needs rebuilding?

.onAttach <- function(libname, pkgname) {
  packageStartupMessage(
    'Run `learnr::run_tutorial("tidy", package = "tidyquiz")` to start the quiz'
  )
}

Deal with conflicts

  • Ignore conflicts completely (easy, not as exciting)
  • Allow more than one correct answer

Package name appears more than once as an answer

See seed 4765.

The function StatBinhex is from which tidyverse package?

  • {ggplot2}
  • {broom}
  • {ggplot2}
  • {xml2}

Related to the method of excluding the correct answer, i.e. from the Rmd:

# Get wrong answer 1 of 3
ans_wrong1 <- eventReactive(
  input$goButton,
  { 
    set.seed(input$n)
    fun_sample <- sample_n(tidy_funs, 1)
    fun_name <- select(fun_sample, functions) %>% pull()
    # PROBLEM HERE?    
    dup_lookup <- tidy_funs %>%  
      filter(functions == fun_name) %>% 
      pull(package)
    ans_correct <- fun_sample %>% select(package) %>% pull()
    ans_wrong1 <- tidy_funs %>%
      distinct(package) %>%  # get unique packages
      # OR MAYBE HERE?
      filter(!package %in% c(dup_lookup)) %>%  # ignore packages containing function
      sample_n(1) %>%  # choose a remaining package name at random
      pull()  # to character
    return(ans_wrong1)
  }
)
output$ans_wrong1_out <- renderText({ paste0("{", ans_wrong1(), "}") })

Refresh the questions

User clicks a button and is presented with a fresh set of questions.

The function a user is presented with in a question is selected randomly, as are the possible packages in the answer selections. Could a button generate and present new samples?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.