我如何找到“原产地”? R中的日期 [英] How do I find "origin" of a Date in R
问题描述
如果我有一个使用as.Date函数转换的日期,例如 2015-01-01
如何找到其用作参考的日期?是的,我尝试了?Date
,并尝试使用默认原点,但是在1945年有了几天。我想知道一般如何做,所以我没有
If I have a date that i've converted using the as.Date function, e.g. "2015-01-01"
how can I find out what date it is using as reference for its origin? And yes, I tried ?Date
, and tried using the default origin, but got days in 1945. I would like to know how to do this generally so I don't have to manually check every time I do operations on dates.
推荐答案
如文档中所述,起源
参数不会在 Date
对象中创建相应的属性;
As described in the documentation, the origin
argument does not create a corresponding attribute in the Date
object; it's just to make input easier from integers (e.g., from Excel, SAS, etc. that use different origins).
A A A (我改用 (I'd use 这篇关于我如何找到“原产地”? R中的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! dput $
dput
确认 Date
s是普通旧数字:dput
confirms that Date
s are plain old numbers:d <- as.Date("2000-01-01")
dput(d)
# structure(10957, class = "Date")
str(d)
,但这有时似乎隐藏了信息。 )str(d)
instead, but that sometimes seems to hide information.)