Use these functions to wrap code in a verbosity option. You can wrap blocks of code using with_verbosity(); you can use the adverb verbosely() to modify another function so it acts with verbosity.

with_verbosity(verbosity = c("error", "info", "all", "none"), code)

verbosely(.f, verbosity = c("error", "info", "all", "none"))

Arguments

verbosity

character value to set for verbosity option

code

Code to be run using the verbosity option

.f

function to wrap using verbosity

Value

with_verbosity

The results of the evaluation of the code argument.

verbosely

function with same arguments as .f, which will run using the verbosity argument

Details

Keep in mind that only the "closest" invocation to the code will be effective; the allowable values for verbosity are:

"error"

reports results of all checks that failed

"info"

reports results of all checks that failed, and that find missing optional information

"all"

reports results of all checks

"none"

reports no results

TODO: talk about implementation, steward.verbosity

Examples

with_verbosity("all", stw_meta(diamonds_meta))
#> List of 7 #> $ name : chr "diamonds" #> $ title : chr "Prices of 50,000 round cut diamonds" #> $ description: chr "A dataset containing the prices and other attributes of almost 54,000 diamonds." #> $ sources :List of 2 #> ..$ :List of 3 #> .. ..$ title: chr "DiamondSearchEngine" #> .. ..$ path : chr "http://www.diamondse.info/" #> .. ..$ email: chr "" #> ..$ :List of 3 #> .. ..$ title: chr "ggplot2 package" #> .. ..$ path : chr "https://ggplot2.tidyverse.org/" #> .. ..$ email: chr "" #> $ n_row : int 53940 #> $ n_col : int 10 #> $ dict : tibble [10 × 4] (S3: stw_dict/tbl_df/tbl/data.frame) #> ..$ name : chr [1:10] "price" "carat" "cut" "color" ... #> ..$ type : chr [1:10] "number" "number" "string" "string" ... #> ..$ description: chr [1:10] "price in US dollars ($326--$18,823)" "weight of diamond (0.2--5.01)" "quality of the cut (Fair, Good, Very Good, Premium, Ideal)" "diamond color, from D (best) to J (worst)" ... #> ..$ levels :List of 10 #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : chr [1:5] "Fair" "Good" "Very Good" "Premium" ... #> .. ..$ : chr [1:7] "D" "E" "F" "G" ... #> .. ..$ : chr [1:8] "I1" "SI2" "SI1" "VS2" ... #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> ..- attr(*, "is_valid")= logi TRUE #> - attr(*, "class")= chr "stw_meta"
verbosely(stw_meta, "all")(diamonds_meta)
#> List of 7 #> $ name : chr "diamonds" #> $ title : chr "Prices of 50,000 round cut diamonds" #> $ description: chr "A dataset containing the prices and other attributes of almost 54,000 diamonds." #> $ sources :List of 2 #> ..$ :List of 3 #> .. ..$ title: chr "DiamondSearchEngine" #> .. ..$ path : chr "http://www.diamondse.info/" #> .. ..$ email: chr "" #> ..$ :List of 3 #> .. ..$ title: chr "ggplot2 package" #> .. ..$ path : chr "https://ggplot2.tidyverse.org/" #> .. ..$ email: chr "" #> $ n_row : int 53940 #> $ n_col : int 10 #> $ dict : tibble [10 × 4] (S3: stw_dict/tbl_df/tbl/data.frame) #> ..$ name : chr [1:10] "price" "carat" "cut" "color" ... #> ..$ type : chr [1:10] "number" "number" "string" "string" ... #> ..$ description: chr [1:10] "price in US dollars ($326--$18,823)" "weight of diamond (0.2--5.01)" "quality of the cut (Fair, Good, Very Good, Premium, Ideal)" "diamond color, from D (best) to J (worst)" ... #> ..$ levels :List of 10 #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : chr [1:5] "Fair" "Good" "Very Good" "Premium" ... #> .. ..$ : chr [1:7] "D" "E" "F" "G" ... #> .. ..$ : chr [1:8] "I1" "SI2" "SI1" "VS2" ... #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> ..- attr(*, "is_valid")= logi TRUE #> - attr(*, "class")= chr "stw_meta"
diamonds_meta %>% verbosely(stw_meta, "all")()
#> List of 7 #> $ name : chr "diamonds" #> $ title : chr "Prices of 50,000 round cut diamonds" #> $ description: chr "A dataset containing the prices and other attributes of almost 54,000 diamonds." #> $ sources :List of 2 #> ..$ :List of 3 #> .. ..$ title: chr "DiamondSearchEngine" #> .. ..$ path : chr "http://www.diamondse.info/" #> .. ..$ email: chr "" #> ..$ :List of 3 #> .. ..$ title: chr "ggplot2 package" #> .. ..$ path : chr "https://ggplot2.tidyverse.org/" #> .. ..$ email: chr "" #> $ n_row : int 53940 #> $ n_col : int 10 #> $ dict : tibble [10 × 4] (S3: stw_dict/tbl_df/tbl/data.frame) #> ..$ name : chr [1:10] "price" "carat" "cut" "color" ... #> ..$ type : chr [1:10] "number" "number" "string" "string" ... #> ..$ description: chr [1:10] "price in US dollars ($326--$18,823)" "weight of diamond (0.2--5.01)" "quality of the cut (Fair, Good, Very Good, Premium, Ideal)" "diamond color, from D (best) to J (worst)" ... #> ..$ levels :List of 10 #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : chr [1:5] "Fair" "Good" "Very Good" "Premium" ... #> .. ..$ : chr [1:7] "D" "E" "F" "G" ... #> .. ..$ : chr [1:8] "I1" "SI2" "SI1" "VS2" ... #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> .. ..$ : NULL #> ..- attr(*, "is_valid")= logi TRUE #> - attr(*, "class")= chr "stw_meta"