Skip to content

Instantly share code, notes, and snippets.

@Elaine-AL
Last active November 13, 2019 08:55
Show Gist options
  • Save Elaine-AL/56c7ca72386be070e35f0f95cb7ad5a5 to your computer and use it in GitHub Desktop.
Save Elaine-AL/56c7ca72386be070e35f0f95cb7ad5a5 to your computer and use it in GitHub Desktop.
Getting the first day of every month for a specific range of dates
start_date = "2018/12/5"
end_date = "2019/7/27"
data.frame(start = seq.Date(from = floor_date(as.Date("2018/12/3"), "month"),
to = floor_date(as.Date("2019/7/26"), "month"),
by = "month")
)
# Here are the results!!
# start
#1 2018-12-01
#2 2019-01-01
#3 2019-02-01
#4 2019-03-01
#5 2019-04-01
#6 2019-05-01
#7 2019-06-01
#8 2019-07-01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment