library(learnr) library(tidyverse) library(tutorialExtras) library(gradethis) gradethis_setup() knitr::opts_chunk$set(echo = FALSE)
grade_server("grade")
question_text("Name:", answer_fn(function(value){ if(length(value) >= 1 ) { return(mark_as(TRUE)) } return(mark_as(FALSE) ) }), correct = "submitted", allow_retry = FALSE )
grade_button_ui(id = "grade")
Complete this tutorial while reading Sections 5.2 - 5.4 of the textbook. Each question allows 3 'free' attempts. After the third attempt a 10% deduction occurs per attempt.
You can click the "View Grade" button as many times as you would like to see your current grade and the number of attempts you are on. Before submitting make sure your grade is as expected.
quiz(caption = NULL, # Question 1 question_numeric("Q1) How many European countries are included in the gapminder 2007 dataset?", answer(30, correct = TRUE), allow_retry = TRUE), # Question 2 question_numeric("Q2) What percent of countries in the gapminder2007 dataset have a life expectancy of less than 71.94?", answer(50, correct = TRUE), allow_retry = TRUE), # Question 3 question_numeric("Q3) How many years higher is the average life expectancy in Europe as compared to Africa? Round to 1 decimal place.", answer(22.8, correct = TRUE), step = 0.1, allow_retry = TRUE), # Question 4 question("Q4) What is the name of the explanatory variable in the lifeExp_model?", type = "learnr_text", answer("continent", correct = TRUE), allow_retry = TRUE), # Question 5 question("Q5) When x refers to the country Germany, what is the value of the indicator function $1_{Amer}(x)$?", type = "learnr_text", answer("0", correct = TRUE), allow_retry = TRUE), # Question 6 question_numeric("Q6) After fitting lifeExp_model to the gapminder2007 dataset, what is the value of $y - \\hat{y}$ for the country Angola? Round to 3 decimal places.", answer(-12.075, correct = TRUE), step = 0.001, allow_retry = TRUE), # Question 7 question_numeric("Q7) According to the lifeExp_model fit to the gapminder2007 dataset, what is the estimated life expectancy for the country Bangladesh? Round to 1 decimal place.", answer(70.7, correct = TRUE), step = 0.1, allow_retry = TRUE), # Question 8 question("Q8) What is the potential confounding variable in the 'sleeping with shoes on' and 'waking up with a headache' example?", type = "learnr_text", answer_fn(function(value){ if (str_remove_all(str_to_lower(value), " ") %in% c("alcohol", "drinking", "intoxicated", "intoxication") ) { return(mark_as(TRUE)) } return(mark_as(FALSE) ) }), allow_retry = TRUE), # Question 9 question("Q9) If all the data points fall perfectly on the regression line, what would be the value of $\\sum_{i=1}^{n} (y_i - \\hat{y}_i)^2$?", type = "learnr_text", answer("0", correct = TRUE), allow_retry = TRUE))
Once you are finished:
grade_print_ui("grade")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.