Last active
January 16, 2016 23:57
-
-
Save steveharoz/2916944e3405eaaacd82 to your computer and use it in GitHub Desktop.
Learning how to make a sequence along a time axes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mydate1 = as.Date("2000-01-01") | |
mydate2 = as.Date("2000-03-01") | |
# EASY: sequence with every other int | |
seq(1, 60, by=2) | |
# HARD: sequence with every other day | |
seq(mydate1, mydate2, by=???) # day? | |
# pretend you're new to R | |
# you don't know about lubridate or POSIX | |
# try to discover the answer as though you're naive | |
# start from ?seq and google searches | |
# HARDER: sequence sampled at 2x per day (every 12 hours) | |
seq(mydate1, mydate2, ???) | |
# HINT: things that don't work: | |
seq(mydate1, mydate2, days(2)) | |
seq(mydate1, mydate2, hours(12)) | |
seq(mydate1, mydate2, by=0.5) | |
seq(mydate1, mydate2, length.out=120) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment