How to create date from datetime (using lubridate)?

前端 未结 2 2010
别那么骄傲
别那么骄傲 2021-01-12 08:14

Assume I have created a variable containing date and time:

a <- ymd_hms(\"2014-01-01 12:23:34\")

How do I create another variable that o

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-12 08:58

    Using date() is much shorter and avoids any issues with rounding.

    library(lubridate)
    date(a)
    [1] "2014-01-01"
    

提交回复
热议问题