ages_as_ordered {halk}R Documentation

Convert ages from/to ordered factor

Description

In order for the machine learning models to properly predict ages, the known ages should be converted to an ordered factor during model fitting. This will ensure that the predict.* functions return age values that actually make sense.

Usage

ages_as_ordered_factor(data, age_col = "age")

ages_as_integer(data, age_col = "est.age")

Arguments

data

A data.frame with a column corresopnding to age_col or a vector of values

age_col

Character. The name of the column that contains ages

Value

A data.frame with the values in age_col converted to an ordered factor


[Package halk version 0.0.5 Index]