gpt4 book ai didi

r - 以6开头的数字日期的起源是什么?

转载 作者:行者123 更新时间:2023-12-04 03:48:01 26 4
gpt4 key购买 nike

我有数字日期,全部以数字 6 开头,我知道x日期在startDateendDate之间。

示例数据:

#dput(df1)
df1 <- structure(list(
startDate = structure(c(9748, 11474, 12204, 12204), class = "Date"),
endDate = structure(c(16645, 16535, 13376, 15863), class = "Date"),
x = c(63719L, 63622L, 60448L, 62940L)),
row.names = c(NA, -4L), class = "data.frame")

?as.Date暗示了许多起源,没有一个可行的:
as.Date(63719, origin = "1900-01-01")
# [1] "2074-06-16"
as.Date(63719, origin = "1899-12-30")
# [1] "2074-06-14"
as.Date(63719, origin = "1904-01-01")
# [1] "2078-06-15"
as.Date(63719, origin = "1970-01-01")
# [1] "2144-06-16"

有任何想法吗?

最佳答案

原点可能是MUMPS的原点日期"1840-12-31",此日期的原因已在MUMPS语言常见问题解答中进行了解释:

27. "What happened in 1841?"

When I decided on specifications for the date routine, I remembered reading of the oldest (one of the oldest?) U.S. citizen, a Civil War veteran, who was 121 years old at the time. Since I wanted to be able to represent dates in a Julian-type form so that age could be easily calculated and to be able to represent any birth date in the numeric range selected, I decided that a starting date in the early 1840s would be 'safe.' Since my algorithm worked most logically when every fourth year was a leap year, the first year was taken as 1841. The zero point was then December 30, 1840...

That's the origin of December 31, 1840 or January 1, 1841. I wasn't party to the MDC negotiations, but I did explain the logic of my choice to members of the Committee.



Wikipedia System time:
Language/Application    Function or variable    Resolution  Epoch or range
MUMPS $H (short for $HOROLOG) 1 s 31 December 1840

让我们测试一下:
df1$xClean <- as.Date(df1$x, origin = "1840-12-31")
df1$xClean > df1$startDate & df1$xClean < df1$endDate
# [1] TRUE TRUE TRUE TRUE

注意:感谢 @Frank将我指向 this blogpost,这使我想到了原始的MUMPS常见问题解答。我发布了自我问答,以供引用,因为搜索SO和Google的 yield 不高。

关于r - 以6开头的数字日期的起源是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55531333/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com