
Last chance! 50% off unlimited learning
Sale ends in
Expands a temporal data frame and fills values for missing dates.
expandData(
data,
expand,
expandTo = c("all", "event"),
valueColumns,
latest_values = F,
valueLevels = NA,
timestamp,
timestampFormat = c("day", "week", "month", "quarter", "year"),
keepData = T
)
Data frame that will be expanded.
Name of the variables that will be expanded.
Defines whether values for the variables to be expanded will be filled for all dates or only those dates included in the data.
Name of the columns that are filled with specific values.
If True missing values are filled with the latest known value until the next known value comes in.
Specific values that are used to fill the value columns. If latest_values = TRUE only values with no known values in the past of this values are specified with this specific values.
Name of the column including the timestamp. This column should be in Date , YY-mm, YYYY-'W'ww, YYYY-mm, YYYY-'Q'q or YYYY format.
Declares in which format the timestamp comes in (i.e., "day", "week", "month", "quarter", "year").
Defines whether variables that will not be expanded should be kept.
Returns the expanded data frame.
# NOT RUN {
data("Amount")
expandedItems = expandData(Amount,
expand = c("item", "itemgroup"),
expandTo = "all",
valueColumns = c("amount", "value"),
latest_values = TRUE,
valueLevels = c(0, 0),
timestamp = "date",
timestampFormat = "day")
# }
Run the code above in your browser using DataLab