hardhat1.4.2 package

Construct Modeling Packages

add_intercept_column

Add an intercept column to data

check_quantile_levels

Check levels of quantiles

contr_one_hot

Contrast function for one-hot encodings

default_formula_blueprint

Default formula blueprint

default_recipe_blueprint

Default recipe blueprint

default_xy_blueprint

Default XY blueprint

delete_response

Delete the response from a terms object

extract_ptype

Extract a prototype

fct_encode_one_hot

Encode a factor as a one-hot indicator matrix

forge

Forge prediction-ready data

frequency_weights

Frequency weights

get_data_classes

Extract data classes from a data frame or matrix

get_levels

Extract factor levels from a data frame

hardhat-extract

Generics for object extraction

hardhat-package

hardhat: Construct Modeling Packages

importance_weights

Importance weights

is_blueprint

Is x a preprocessing blueprint?

is_case_weights

Is x a case weights vector?

is_frequency_weights

Is x a frequency weights vector?

is_importance_weights

Is x an importance weights vector?

model_frame

Construct a model frame

model_matrix

Construct a design matrix

model_offset

Extract a model offset

modeling-usethis

Create a modeling package

mold

Mold data for modeling

new_case_weights

Extend case weights

new_frequency_weights

Construct a frequency weights vector

new_importance_weights

Construct an importance weights vector

new_model

Constructor for a base model

new-blueprint

Create a new preprocessing blueprint

new-default-blueprint

Create a new default blueprint

quantile_pred

Create a vector containing sets of quantiles

recompose

Recompose a data frame into another form

refresh_blueprint

Refresh a preprocessing blueprint

run-forge

forge() according to a blueprint

run-mold

mold() according to a blueprint

scream

Scream

shrink

Subset only required columns

spruce-multiple

Spruce up multi-outcome predictions

spruce

Spruce up predictions

standardize

Standardize the outcome

tune

Mark arguments for tuning

update_blueprint

Update a preprocessing blueprint

validate_column_names

Ensure that data contains required column names

validate_no_formula_duplication

Ensure no duplicate terms appear in formula

validate_outcomes_are_binary

Ensure that the outcome has binary factors

validate_outcomes_are_factors

Ensure that the outcome has only factor columns

validate_outcomes_are_numeric

Ensure outcomes are all numeric

validate_outcomes_are_univariate

Ensure that the outcome is univariate

validate_prediction_size

Ensure that predictions have the correct number of rows

validate_predictors_are_numeric

Ensure predictors are all numeric

weighted_table

Weighted table

Building modeling packages is hard. A large amount of effort generally goes into providing an implementation for a new method that is efficient, fast, and correct, but often less emphasis is put on the user interface. A good interface requires specialized knowledge about S3 methods and formulas, which the average package developer might not have. The goal of 'hardhat' is to reduce the burden around building new modeling packages by providing functionality for preprocessing, predicting, and validating input.

  • Maintainer: Hannah Frick
  • License: MIT + file LICENSE
  • Last published: 2025-08-20