Find day of year with the lubridate package in R

烂漫一生 提交于 2019-12-04 02:47:09

问题


I'm looking to find the day of year for a POSIXct class object with lubridate. For example, 12-9-2015 is day 343.

It's easy to find the day of the week or month with lubridate:

> lubridate::wday("2015-12-09 04:27:56 EST", labels = T)
Wed
> lubridate::day("2015-12-09 04:27:56 EST")
9

Is there an easy way to do so for the day of the year? I've searched the documentation and other questions but have not (yet) found an answer.


回答1:


The correct function is yday, as in

lubridate::yday(Sys.time())


来源:https://stackoverflow.com/questions/34189367/find-day-of-year-with-the-lubridate-package-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!