1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/holiday.R
3\name{step_holiday}
4\alias{step_holiday}
5\title{Holiday Feature Generator}
6\usage{
7step_holiday(
8  recipe,
9  ...,
10  role = "predictor",
11  trained = FALSE,
12  holidays = c("LaborDay", "NewYearsDay", "ChristmasDay"),
13  columns = NULL,
14  keep_original_cols = TRUE,
15  skip = FALSE,
16  id = rand_id("holiday")
17)
18}
19\arguments{
20\item{recipe}{A recipe object. The step will be added to the
21sequence of operations for this recipe.}
22
23\item{...}{One or more selector functions to choose variables
24for this step. The selected variables should have class \code{Date} or
25\code{POSIXct}. See \code{\link[=selections]{selections()}} for more details.}
26
27\item{role}{For model terms created by this step, what analysis role should
28they be assigned? By default, the new columns created by this step from
29the original variables will be used as \emph{predictors} in a model.}
30
31\item{trained}{A logical to indicate if the quantities for
32preprocessing have been estimated.}
33
34\item{holidays}{A character string that includes at least one
35holiday supported by the \code{timeDate} package. See
36\code{\link[timeDate:holiday-Listing]{timeDate::listHolidays()}} for a complete list.}
37
38\item{columns}{A character string of variables that will be
39used as inputs. This field is a placeholder and will be
40populated once \code{\link[=prep.recipe]{prep.recipe()}} is used.}
41
42\item{keep_original_cols}{A logical to keep the original variables in the
43output. Defaults to \code{TRUE}.}
44
45\item{skip}{A logical. Should the step be skipped when the
46recipe is baked by \code{\link[=bake.recipe]{bake.recipe()}}? While all operations are baked
47when \code{\link[=prep.recipe]{prep.recipe()}} is run, some operations may not be able to be
48conducted on new data (e.g. processing the outcome variable(s)).
49Care should be taken when using \code{skip = TRUE} as it may affect
50the computations for subsequent operations.}
51
52\item{id}{A character string that is unique to this step to identify it.}
53}
54\value{
55An updated version of \code{recipe} with the new step added to the
56sequence of any existing operations.
57}
58\description{
59\code{step_holiday} creates a \emph{specification} of a
60recipe step that will convert date data into one or more binary
61indicator variables for common holidays.
62}
63\details{
64Unlike some other steps, \code{step_holiday} does \emph{not}
65remove the original date variables by default. Set \code{keep_original_cols}
66to \code{FALSE} to remove them.
67
68When you \code{\link[=tidy]{tidy()}} this step, a tibble with columns \code{terms}
69(the columns that will be affected) and \code{holiday} is returned.
70}
71\examples{
72library(lubridate)
73
74examples <- data.frame(someday = ymd("2000-12-20") + days(0:40))
75holiday_rec <- recipe(~ someday, examples) \%>\%
76   step_holiday(all_predictors())
77
78holiday_rec <- prep(holiday_rec, training = examples)
79holiday_values <- bake(holiday_rec, new_data = examples)
80holiday_values
81}
82\seealso{
83\code{\link[timeDate:holiday-Listing]{timeDate::listHolidays()}}
84
85Other dummy variable and encoding steps:
86\code{\link{step_bin2factor}()},
87\code{\link{step_count}()},
88\code{\link{step_date}()},
89\code{\link{step_dummy_multi_choice}()},
90\code{\link{step_dummy}()},
91\code{\link{step_factor2string}()},
92\code{\link{step_indicate_na}()},
93\code{\link{step_integer}()},
94\code{\link{step_novel}()},
95\code{\link{step_num2factor}()},
96\code{\link{step_ordinalscore}()},
97\code{\link{step_other}()},
98\code{\link{step_regex}()},
99\code{\link{step_relevel}()},
100\code{\link{step_string2factor}()},
101\code{\link{step_unknown}()},
102\code{\link{step_unorder}()}
103}
104\concept{dummy variable and encoding steps}
105