is.predx_df will verify that a predx data frame contains valid predx_class and predx columns. as.predx_df will create a predx data frame from a list or tibble and add the predx_class column if not found.

validate_predx_df(x, return = F)

is.predx_df(x)

as.predx_df(x)

Arguments

x

A list or a tibble including a list or column named predx containing only predx objects. Not a base data.frame because the predx objects cannot be embedded, as.predx_df will embed them.

Value

Error message or TRUE.

Examples

as.predx_df(list( location = c('Mercury', 'Venus', 'Earth'), target = 'habitability', predx = list(Binary(0), Binary(0), Binary(1)) ))
#> # A tibble: 3 x 4 #> location target predx predx_class #> <chr> <chr> <list> <chr> #> 1 Mercury habitability <Binary> Binary #> 2 Venus habitability <Binary> Binary #> 3 Earth habitability <Binary> Binary
x <- as.predx_df( list( target = c('demoCat', 'demoBinary'), date = 'tomorrow', predx = list( BinCat( data.frame( cat = c('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'), prob = c(0, rep(0.1, 4), 0.25, 0.15, 0.1, rep(0.05, 2)) ) ), Binary(0.1) ) ) )