predx_df: Tools to check the 'predx' data frames contain valid...

Description Usage Arguments Value Examples

Description

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.

Usage

1
2
3
4
5

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
as.predx_df(list(
 location = c('Mercury', 'Venus', 'Earth'),
 target = 'habitability',
 predx = list(Binary(0), Binary(0), Binary(1))
))
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)
      )
    )
  )

cdcepi/predx documentation built on Dec. 29, 2019, 4:58 p.m.