Inspects properties of a base::data.frame() and prints code to the console that a developer can use to start to check the properties of a dataset, such as the names and types of each column.

verify_value_headstart(d)

Arguments

d

The data.frame to verify. Required.

See also

checkmate

Author

Will Beasley

Examples

library(magrittr)
verify_value_headstart(datasets::OrchardSprays)
#> checkmate::assert_numeric( ds$decrease  , any.missing=F , lower=2, upper=130 )
#> checkmate::assert_numeric( ds$rowpos    , any.missing=F , lower=1, upper=8   )
#> checkmate::assert_numeric( ds$colpos    , any.missing=F , lower=1, upper=8   )
#> checkmate::assert_factor(  ds$treatment , any.missing=F                      )
verify_value_headstart(datasets::iris)
#> checkmate::assert_numeric( ds$Sepal.Length , any.missing=F , lower=4, upper=8 )
#> checkmate::assert_numeric( ds$Sepal.Width  , any.missing=F , lower=2, upper=5 )
#> checkmate::assert_numeric( ds$Petal.Length , any.missing=F , lower=1, upper=7 )
#> checkmate::assert_numeric( ds$Petal.Width  , any.missing=F , lower=0, upper=3 )
#> checkmate::assert_factor(  ds$Species      , any.missing=F                    )
verify_value_headstart(datasets::BOD)
#> checkmate::assert_numeric( ds$Time   , any.missing=F , lower=1, upper=7  , unique=T)
#> checkmate::assert_numeric( ds$demand , any.missing=F , lower=8, upper=20 , unique=T)
verify_value_headstart(dplyr::band_members)
#> checkmate::assert_character(ds$name , any.missing=F , pattern="^.{4,4}$" , unique=T)
#> checkmate::assert_character(ds$band , any.missing=F , pattern="^.{6,7}$" )
storms_2 <- dplyr::storms %>%
  dplyr::mutate(
    storm_date = as.Date(ISOdate(year, month, day))
  )
verify_value_headstart(storms_2)
#> checkmate::assert_character(ds$name                         , any.missing=F , pattern="^.{3,9}$"                                       )
#> checkmate::assert_numeric(  ds$year                         , any.missing=F , lower=1975, upper=2022                                   )
#> checkmate::assert_numeric(  ds$month                        , any.missing=F , lower=1, upper=12                                        )
#> checkmate::assert_integer(  ds$day                          , any.missing=F , lower=1, upper=31                                        )
#> checkmate::assert_numeric(  ds$hour                         , any.missing=F , lower=0, upper=23                                        )
#> checkmate::assert_numeric(  ds$lat                          , any.missing=F , lower=7, upper=71                                        )
#> checkmate::assert_numeric(  ds$long                         , any.missing=F , lower=-137, upper=14                                     )
#> checkmate::assert_factor(   ds$status                       , any.missing=F                                                            )
#> checkmate::assert_numeric(  ds$category                     , any.missing=T , lower=1, upper=5                                         )
#> checkmate::assert_integer(  ds$wind                         , any.missing=F , lower=10, upper=165                                      )
#> checkmate::assert_integer(  ds$pressure                     , any.missing=F , lower=882, upper=1024                                    )
#> checkmate::assert_integer(  ds$tropicalstorm_force_diameter , any.missing=T , lower=0, upper=1440                                      )
#> checkmate::assert_integer(  ds$hurricane_force_diameter     , any.missing=T , lower=0, upper=300                                       )
#> checkmate::assert_date(     ds$storm_date                   , any.missing=F , lower=as.Date("1975-06-27"), upper=as.Date("2022-11-11") )