time series data set for practice in R

 set.seed(123)


time_series_data <- tibble(

  date = seq.Date(from = as.Date("2015-01-01"),

                  to   = as.Date("2023-12-01"),

                  by   = "month"),

  

  sales = round(

    500 + 20 * seq_along(date) +          # Trend

      200 * sin(2 * pi * seq_along(date) / 12) +  # Seasonality

      rnorm(length(date), sd = 80),       # Noise

    0

  )

)


print(time_series_data)


Comments

Popular posts from this blog

SQL handouts