I'm trying to build a long vector of dates: I have the final date (today) and I know the duration (n*m minutes). However, to create a seq, I need a start_date, and the %--% is complaining that I need an origin. Can you help me solve this?
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#>
#> date
# define data set
m <- 3
n <- 10^4
stop_date <- now()
period <- minutes(n*m)
start_date <- stop_date %--% period
#> Error in as.POSIXct.numeric(x, tz = tz): 'origin' must be supplied
date_time <- seq(start_date, stop_date, length.out = n*m)
#> Error in seq(start_date, stop_date, length.out = n * m): oggetto "start_date" non trovato
Created on 2018-09-10 by the reprex
package (v0.2.0).