Giter VIP home page Giter VIP logo

checkr's People

Contributors

dtkaplan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

checkr's Issues

Integrate `pre_check()` into `for_checkr()`

Have pre_check() do the step by step evaluation instead of for_checkr(). Right now there's redundancy: both functions are doing it.

Add an argument to for_checkr() with the solution code, so that spell checks can take place within that context.

Add a SOLN_CODE binding along with USER_CODE. That will make it easier to pass any solution code to the new for_checkr().

Issue with using the ._arg functions

I have been trying to use checkr with learnr and keep coming across an issue when trying to extract function arguments. I have tried named_arg, function_arg and data_arg and get the same error. Using the examples provided:

code <- for_checkr(quote(lm(mpg ~ hp, data = mtcars)))
formula_arg(code)

checkr result fail with message:
Error : Can't take the names() of the .data pronoun

data_arg(code, insist("hp" %in% names(V), "The data should have a column named 'hp'."))

checkr result fail with message:
Error : Can't take the names() of the .data pronoun

named_arg(code, "data", failif(E == mtcars, "I didn't want mtcars."))

checkr result fail with message:
Error : Can't take the names() of the .data pronoun

Struggling to do multiple tests

Hi, I am new to this package. I am struggling to do multiple tests by assigning tests to t1, t2, t3 e.t.c. and then using

if (failed(t1)) return(t1)

I am getting the error message (code not found)

Was wondering if I was the only person with this issue.

For context I have being trying to apply the lm modelling code from the vignette to a different modelling example:

check_tree <- function(USER_CODE) {
code <- for_checkr(USER_CODE) # pre-processing
rpart_line <- line_calling(code, rpart, message = "Use rpart() to construct the model.")
rpart_call <- arg_calling(rpart_line, rpart)
t1 <- data_arg(rpart_call,
insist(identical(V, trainingdata),
"Your data argument {{E}} was not trainingdata."),
message = "You didn't supply a data = argument to rpart().")
if (failed(t1)) return(t1)
f <- formula_arg(rpart_call,
message = "You didn't give a formula specifying the structure of the model.")
t2 <- check(f, insist(two_sided(f), "There's no response variable in your formula."))

if (failed(t2)) return(t2)

}

Need better handling of formulas

When capturing a formula with check_blanks, what get's captured is actually the call to generate the formula, not the formula itself. You need to evaluate the formula-call before you can compare it to another formula, e.g.

check_blanks(code, quote(lm(..form.., data = iris)))
failif(eval(form) == (Sepal.Length ~ Species)

This seems awkward.

error when installing vignettes

Since devtools 2.0.0 the command to build vignettes devtools::install_github("dtkaplan/checkr", build_vignettes=TRUE) does not work anymore. Therefore I used the new syntax.

But I got an error:

E  creating vignettes (9s)
   Quitting from lines 639-640 (checkr.Rmd) 
   Error: processing vignette 'checkr.Rmd' failed with diagnostics:
   is.name(e1) || is.character(e1) is not TRUE
   Execution halted
Error in processx::run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout),  : 
  System command error

Verifying only syntax

Is it possible to not execute submitted code and only verify the syntax? I created a question about opening file and how to use parameters (sep, header, etc). I want the student to write a line of code that would read a file and verify only the code since the file is not available.

Thank you for the great package.

Providing a very simple example

I am trying to use learnr with checkr. But I cannot understand the general logic. Could you provide a very simple example to demonstrate the interplay between learnr and checkr? - Your examples in your vignette checkr.Rmd are already very complex.

I am thinking of explanations which elaborates the simple examples of the "Interactive Tutorial" - template, provided by learnr, e.g. checking the code for "Write the R code required to add two plus two". As the main use case of checkr is in conjunction with learnr it should preferably elaborate the exercise part of the learnr tutorial.

To give you more information about my difficulties:

  1. I have copied your function check_exer_1_v0 for the rep(1:4, each = 3) example in a script file "check_test.R" under a folder "www".
  2. I have added the line tutorial_options(exercise.checker = checkr::check_for_learnr) to the setup chunk.
  3. In the setup chunk I have also included the command source("../www/check_test.R") as my R Markdownfile "01-Exercise.RMD" is under the folder "01-Exercise".
  4. I have added the markdown text Use the rep() function, with 1:4 as an input, to generate the 12-element vector 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4.
  5. I have added an empty R chunk with the label exercise1 and the chunk option exercise=TRUE.
  6. I created another R chunk labeled exercise1-check

So far I believe I did all things correctly. But now I do not know what to put into the exercise1-check chunk.

After many trials, I finally succeeded with check_exer_1_v0(USER_CODE)

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.