View source: R/dummy_regressor.R
dummy_regressor | R Documentation |
dummy regressor for a numerical variable.
dummy_regressor(y, strategy = "mean", quantile = NULL, constant = NULL)
y |
a numerical vector. |
strategy |
a strategy from "constant", "mean", "median", or "quantile". |
quantile |
used when using the quantile strategy. It is a value between 0 and 1. |
constant |
used when using the constant strategy. It is a numeric value. |
a list containing information of the model.
# Split the data into training and testing sets
set.seed(2023)
index <- sample(1:nrow(iris), nrow(iris) * 0.8)
train_data <- iris[index,]
test_data <- iris[-index,]
reg_model <- dummy_regressor(train_data$Sepal.Length, strategy = "median")
reg_model
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.