Skip to content

problems with as.difftime #2

Description

@chiefmurph

email 11/2/2015 10:19pm from Wu Junzhou:

Dear Murphy,

I encountered a problem when trying to calculate years between two dates.Here is the code:

require(mondate)
date1 = mondate("2015-12-31")
date2 = mondate("2013-12-01")
as.difftime(date1-date2)
Time difference of 24.96774 months
as.difftime(date1-date2,units = "years")
Error in as.difftime(date1 - date2, units = "years") :
'tim' must be numeric for units = 'years'

sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] mondate_0.10.01.02

loaded via a namespace (and not attached):
[1] tools_3.2.2

I have found no solution with this problem in the internet.

I hope to look forward for your support

sincerely,

Wu Junzhou

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions