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

标签 r date

我有数字日期,全部以数字 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/

相关文章:

r - 在另一个字符串中为 data.frame 的每一行查找字符串位置(索引)

r - 循环运行时如何获取链接?

date - 在orientDB中,如何搜索给定年份中的日期的条目?

ios - 将 UTC 日期格式转换为本地 nsdate

javascript - 这是什么时间格式,如何将其转换为纪元?

r - 将基准年索引添加到具有多个组的 R 数据框

r - 将两个日期框架组合到相同的列但在不同的日期下

php - 将日期字符串 (Y-m-d) 转换为 "Mar 2nd"php/mysql

r - R 中的数据集文件大小,可能的开销吗?

java - java中的日期只有年份