
Last chance! 50% off unlimited learning
Sale ends in
CreateCalendarVariables Rapidly creates calendar variables based on the date column you provide
CreateCalendarVariables(
data,
DateCols = NULL,
AsFactor = FALSE,
TimeUnits = "wday"
)
This is your data
Supply either column names or column numbers of your date columns you want to use for creating calendar variables
Set to TRUE if you want factor type columns returned; otherwise integer type columns will be returned
Supply a character vector of time units for creating calendar variables. Options include: "second", "minute", "hour", "wday", "mday", "yday", "week", "isoweek", "wom" (week of month), "month", "quarter", "year"
Returns your data.table with the added calendar variables at the end
Other Feature Engineering:
AutoDataPartition()
,
AutoDiffLagN()
,
AutoHierarchicalFourier()
,
AutoInteraction()
,
AutoLagRollStatsScoring()
,
AutoLagRollStats()
,
AutoTransformationCreate()
,
AutoTransformationScore()
,
AutoWord2VecModeler()
,
AutoWord2VecScoring()
,
CreateHolidayVariables()
,
DummifyDT()
,
H2OAutoencoderScoring()
,
H2OAutoencoder()
,
ModelDataPrep()
,
TimeSeriesFill()
# NOT RUN {
# Create fake data with a Date column----
data <- RemixAutoML::FakeDataGenerator(
Correlation = 0.75,
N = 25000L,
ID = 2L,
ZIP = 0L,
FactorCount = 4L,
AddDate = TRUE,
Classification = FALSE,
MultiClass = FALSE)
for(i in seq_len(20L)) {
print(i)
data <- data.table::rbindlist(
list(data, RemixAutoML::FakeDataGenerator(
Correlation = 0.75,
N = 25000L,
ID = 2L,
ZIP = 0L,
FactorCount = 4L,
AddDate = TRUE,
Classification = FALSE,
MultiClass = FALSE)))
}
# Create calendar variables - automatically excludes
# the second, minute, and hour selections since
# it is not timestamp data
runtime <- system.time(
data <- RemixAutoML::CreateCalendarVariables(
data = data,
DateCols = "DateTime",
AsFactor = FALSE,
TimeUnits = c("second",
"minute",
"hour",
"wday",
"mday",
"yday",
"week",
"isoweek",
"wom",
"month",
"quarter",
"year")))
head(data)
print(runtime)
# }
Run the code above in your browser using DataLab