diff --git a/R/insert_exercise_check_code.R b/R/insert_exercise_check_code.R index 12cda465..f5e2202e 100644 --- a/R/insert_exercise_check_code.R +++ b/R/insert_exercise_check_code.R @@ -5,7 +5,7 @@ insert_exercise_check_code <- function() { rstudioapi::insertText(glue::glue(" ```{r <>, exercise = TRUE} # student code - +____ ``` ```{r <>-hint-1} @@ -25,7 +25,7 @@ insert_exercise_check_code <- function() { ```{r <>-check} # check code -grader::check_code() +gradethis::check_code() ``` " , .open = "<<", .close = ">>")) # nolint end @@ -38,7 +38,7 @@ insert_exercise_check_result <- function() { rstudioapi::insertText(glue::glue(" ```{r <>, exercise = TRUE} # student code - +____ ``` ```{r <>-hint-1} @@ -52,9 +52,9 @@ insert_exercise_check_result <- function() { ``` ```{r <>-check} -grader::check_result( - grader::pass_if(~ .result == 1, \"YAY!\"), - grader::fail_if(~ .result == 2, \"Try Again.\") +gradethis::check_result( + gradethis::pass_if(~ identical(.result, 1), \"YAY!\"), + gradethis::fail_if(~ identical(.result, 2), \"Try Again.\") ) ``` " , .open = "<<", .close = ">>")) diff --git a/R/view_tutorial.R b/R/view_tutorial.R index 71e9f9cf..921961f0 100644 --- a/R/view_tutorial.R +++ b/R/view_tutorial.R @@ -103,7 +103,7 @@ add_tutorial <- function(name, package) { } } cat(paste0( - 'grader::view_tutorial(name = "', + 'gradethis::view_tutorial(name = "', name, '", package = "', package, '") ## Learnr tutorial added on ', Sys.Date() diff --git a/grader.Rproj b/gradethis.Rproj similarity index 100% rename from grader.Rproj rename to gradethis.Rproj diff --git a/inst/tutorials/grading-demo/grading-demo.Rmd b/inst/tutorials/grading-demo/grading-demo.Rmd index cdb90cee..2e4391af 100644 --- a/inst/tutorials/grading-demo/grading-demo.Rmd +++ b/inst/tutorials/grading-demo/grading-demo.Rmd @@ -8,7 +8,7 @@ runtime: shiny_prerendered ```{r setup, include=FALSE} library(learnr) -library(grader) +library(gradethis) tutorial_options(exercise.timelimit = 60, exercise.checker = grade_learnr) knitr::opts_chunk$set(echo = FALSE) @@ -19,7 +19,7 @@ knitr::opts_chunk$set(echo = FALSE) ### Check Exercise Result -`grader` can check for the final returned value. This grading approach does not inspect the code. It only inspects the final result. +`gradethis` can check for the final returned value. This grading approach does not inspect the code. It only inspects the final result. See `?check_result` for more information. @@ -77,7 +77,7 @@ check_result( ### Test Exercise Result -`grader` can test against for the final returned value. This grading approach does not inspect the code. It only inspects the final result. +`gradethis` can test against for the final returned value. This grading approach does not inspect the code. It only inspects the final result. Writers can include as many testing functions as they would like. The test functions should accept a single result value to test against. If any test fails, it should throw an error. This error message will be returned back to the user by default. See `?test_result` for more information. @@ -181,7 +181,7 @@ test_result( ### Check Exercise Code -`grader` can test against an exact code match. This grading approach does not inspect the computed result. +`gradethis` can test against an exact code match. This grading approach does not inspect the computed result. This check method requires a `*-solution` code chunk containing the solution to compare. Only the last solution expression and last user expression will be matched. @@ -245,7 +245,7 @@ check_code("Good job. Don't worry, things will soon get harder.") ## Custom Checking Code -`grader` can accept any checking method that returns a `grader::result` object. The example below returns a correct/incorrect answer with 50/50 probability. +`gradethis` can accept any checking method that returns a `gradethis::result` object. The example below returns a correct/incorrect answer with 50/50 probability. ````markdown @@ -261,7 +261,7 @@ fifty_fifty_checker <- function( user ) { is_correct <- (runif(1) < 0.5) - grader::result( + gradethis::result( x = user, correct = is_correct, message = ifelse(is_correct, correct, incorrect) @@ -289,7 +289,7 @@ fifty_fifty_checker <- function( user ) { is_correct <- (runif(1) < 0.5) - grader::result( + gradethis::result( x = user, correct = is_correct, message = ifelse(is_correct, correct, incorrect) diff --git a/inst/tutorials/recording-demo/recording-demo.Rmd b/inst/tutorials/recording-demo/recording-demo.Rmd index d748bf54..d25f3d7c 100644 --- a/inst/tutorials/recording-demo/recording-demo.Rmd +++ b/inst/tutorials/recording-demo/recording-demo.Rmd @@ -6,7 +6,7 @@ runtime: shiny_prerendered ```{r setup, include=FALSE} library(learnr) -library(grader) +library(gradethis) library(googlesheets) # Specify a googlesheet to record to diff --git a/inst/tutorials/scoping-rules/scoping-rules.Rmd b/inst/tutorials/scoping-rules/scoping-rules.Rmd index b1b52347..501acda5 100644 --- a/inst/tutorials/scoping-rules/scoping-rules.Rmd +++ b/inst/tutorials/scoping-rules/scoping-rules.Rmd @@ -18,8 +18,8 @@ The best way to reproduce the effects described in this tutorial is to run this ```{r eval = FALSE} foo <- "Remember me." # this will be significant -devtools::install_github("rstudio-education/grader") -learnr::run_tutorial("scoping-rules", package = "grader") +devtools::install_github("rstudio-education/gradethis") +learnr::run_tutorial("scoping-rules", package = "gradethis") ``` ### Knitr chunks @@ -53,7 +53,7 @@ As a result, the objects in _your_ global environment will not be available when To try this, close the tutorial and then run this code and click the Run Document button. ```{r eval = FALSE} -rstudioapi::navigateToFile(system.file("tutorials", "scoping-rules/scoping-rules.Rmd", package = "grader")) +rstudioapi::navigateToFile(system.file("tutorials", "scoping-rules/scoping-rules.Rmd", package = "gradethis")) ``` ### The third case