Reputation: 141
I would like to make a function checking different aspects of a complex list that is outputted by one of my functions. This is to help parametrise this function; there are a lot of parameters influencing the output, and adapting the parametrisation to have the best-fitted output implies a lot of trial and error for the user. In order to facilitate that I would like to make a 'check' function, providing different quantified and logical tests of the output. Ideally, I would like it to have the same style as the output given by devtools::check()
or devtools::build()
, like this:
I tried to go inside the devtools::check()
or devtools::build()
functions, but could not find what they use to have this kind of output. Is it possible to have it for the task I have described ?
Upvotes: 0
Views: 110
Reputation: 5017
Try to use cat
inside your function in this way to map and show update on the function:
f<-function()
{
cat("checking for file\n")
cat("preparing\n")
}
Output:
f()
checking for file
preparing
Differents colours and palette could be added using package colorout.
This is the pattern used inside devtools package:
cat_rule(left = "Building", right = pkg$package, col = "cyan")
Upvotes: 1