Description Usage Arguments Details Value See Also Examples
View source: R/is-output-same.R
The use for this is to evaluate your code while you're cleaning your functions. You can have a function call as the first argument and the name of another function as the second argument, then it will evaluate the functions with the arguments of the call and see if the output is identical.
1 | is.output.same(.call, ..., quiet = FALSE)
|
.call |
Function call, such as ".call = my_function(x = 1:3)" |
... |
One or more function names |
quiet |
Optional warning suppression |
Use only in pipe chains with a length of one, or it will use the code at the top of the pipe-chain. Also it's not recommended to use pipes with this function, as it undoes the evaluation of prior code in the pipe. If you don't pipe in .call, then the function operates off the fact that a call given as an argument is treated as a promise, allowing the code to be wrapped in substitute() inside the function.
logical - TRUE if outputs are identical
1 2 3 4 | is.output.same(purrr::map(1:3, cumsum), lapply) # TRUE
is.output.same(cumsum(1:3), cumprod) # FALSE
is.output.same(sum(1:3), prod) # FALSE for outputs of different class
is.output.same(mean(1:3), prod) # FALSE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.