Skip to content

The .get_data_types() generic is used internally to supply types to columns used in recipes. These functions underlie the work that the user sees in selections.

Usage

.get_data_types(x)

# S3 method for default
.get_data_types(x)

# S3 method for character
.get_data_types(x)

# S3 method for ordered
.get_data_types(x)

# S3 method for factor
.get_data_types(x)

# S3 method for integer
.get_data_types(x)

# S3 method for numeric
.get_data_types(x)

# S3 method for double
.get_data_types(x)

# S3 method for Surv
.get_data_types(x)

# S3 method for logical
.get_data_types(x)

# S3 method for Date
.get_data_types(x)

# S3 method for POSIXct
.get_data_types(x)

# S3 method for list
.get_data_types(x)

# S3 method for textrecipes_tokenlist
.get_data_types(x)

# S3 method for hardhat_case_weights
.get_data_types(x)

Arguments

x

An object

Details

This function acts as an extended recipes-specific version of class(). By ignoring differences in similar types ("double" and "numeric") and allowing each element to have multiple types ("factor" returns "factor", "unordered", and "nominal", and "character" returns "string", "unordered", and "nominal") we are able to create more natural selectors such as all_nominal(), all_string() and all_integer().

Examples


data(Sacramento, package = "modeldata")
lapply(Sacramento, .get_data_types)
#> $city
#> [1] "factor"    "unordered" "nominal"  
#> 
#> $zip
#> [1] "factor"    "unordered" "nominal"  
#> 
#> $beds
#> [1] "integer" "numeric"
#> 
#> $baths
#> [1] "double"  "numeric"
#> 
#> $sqft
#> [1] "integer" "numeric"
#> 
#> $type
#> [1] "factor"    "unordered" "nominal"  
#> 
#> $price
#> [1] "integer" "numeric"
#> 
#> $latitude
#> [1] "double"  "numeric"
#> 
#> $longitude
#> [1] "double"  "numeric"
#>