Why do dates at infinity look like NAs but act like dates? [duplicate]

故事扮演 提交于 2019-11-30 17:28:45

They don't convert to NA, that's just how they're printed.

R> d <- as.Date(-Inf, origin="1970-01-01")
R> is.na(d)
# [1] FALSE
R> is.infinite(d)
# [1] TRUE

If you want them to print differently, you can override the print.Date method and add special cases for +/- infinity.

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