What does the %--% operator do?
What is the difference between using %--% or -?
Why when using both to calculate difference of dates, and then wrapping with as.numeric gives a different result?
And why using as.numeric(unit = "years") only works for the %--%?
.
Asked
Active
Viewed 29 times
0
Henrik
- 61,039
- 13
- 131
- 152
Javier Moreno Sepena
- 11
- 1
-
`library(lubridate); ?"%--%"` – G. Grothendieck Feb 09 '21 at 17:28
-
When looking for information about R functions/operators, it’s often more helpful to search the R help rather than the internet: `help.search('%--%')` (or `??'%--%'`). – Konrad Rudolph Feb 09 '21 at 17:32
-
Nice, I thought was abuilt-in one! What is the difference between using %--% or - ? Why when using both to calculate difference of dates, and then wrapping with "as.numeric" gives a different result? – Javier Moreno Sepena Feb 09 '21 at 17:39
-
I initially closed as a dupe of [What do `%op%` operators do in R?](https://stackoverflow.com/q/12730629/903061), which does show how to find their help pages. Instead, I think OP should focus on the use of `%--%` and it's difference with `-`, as the help page barely mentions `%--%`. – Gregor Thomas Feb 09 '21 at 17:47