Description Usage Arguments Value References Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Originally meant to be a zoo S3 object.
Based on the code of seq.Date.
The situation of "no existing seq.yearmon" drove me nuts!
Therefore I programmed one.
Currently, unlike seq.Date, this function
does not have a difftime implementation.
Currently, unlike seq.Date, this function
does not try to convert to POSIX__.
NOTE: this implementations compliments the gist by adding "by methods"
See. the examples.
|
1 2 |
from |
See ? seq.Date |
to |
See ? seq.Date |
by |
See ? seq.Date. See examples (below). |
length.out |
See ? seq.Date |
along.with |
See ? seq.Date |
... |
See ? seq.Date |
zoo as.yearmon class
R zoo S3 object seq.yearqtr seq.yearmon https://gist.github.com/AndreMikulec/aceb20a0b6c170027b035519ca7a3adb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## Not run:
seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07"))
# Error in seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07")) :
# exactly two of 'to', 'by' and 'length.out' / 'along.with' must be specified
# That is the expected output!
seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07"), length.out = 2)
# [1] "Jan 2000" "Jul 2000"
seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07"), length.out = 3)
# [1] "Jan 2000" "Apr 2000" "Jul 2000"
seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07"), length.out = 4)
# [1] "Jan 2000" "Mar 2000" "May 2000" "Jul 2000"
seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07"), by = 1/12)
# [1] "Jan 2000" "Feb 2000" "Mar 2000" "Apr 2000" "May 2000" "Jun 2000" "Jul 2000"
seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07"), by = 2/12)
# [1] "Jan 2000" "Mar 2000" "May 2000" "Jul 2000"
seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07"), by = "2 yearmons")
# [1] "Jan 2000" "Mar 2000" "May 2000" "Jul 2000"
seq.yearmon(as.yearmon("2000-01"), to = as.yearmon("2000-07"), by = "2 months")
# [1] "Jan 2000" "Mar 2000" "May 2000" "Jul 2000"
seq.yearmon(as.yearmon("2000-07"), to = as.yearmon("2000-01"), by = -1/12)
# [1] "Jul 2000" "Jun 2000" "May 2000" "Apr 2000" "Mar 2000" "Feb 2000" "Jan 2000"
seq.yearmon(as.yearmon("2000-07"), to = as.yearmon("2000-01"), by = "-1 yearmons")
# [1] "Jul 2000" "Jun 2000" "May 2000" "Apr 2000" "Mar 2000" "Feb 2000" "Jan 2000"
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.