Dear all,
I have a problem with the function Julian, may be a bug in the function ?
Here is a vector of character, which represents dates (May 18 to May 20
2000):
> amj <- c("2000-05-18","2000-05-18","2000-05-18","2000-05-19","2000-05-19"
> ,"2000-05-19", "2000-05-19", "2000-05-20", "2000-05-20", "2000-05-20")
I load the date and chron libraries, I define the vector of character as a
date variable using the dates function:
> ymd <- dates(amj,format=c(dates="y-m-d"),origin=c(month=1,
day=1,year=2000))
Then when I apply the Julian function:
> julian(months(ymd),days(ymd),years(ymd),origin=c(month = 1, day = 1, year
= as.numeric(years(ymd[1]))))
I get the following result:
[1] 137 137 137 138 138 138 138 139 139 139
However, when I check on the calendar, the dates I have correspond to the
139th, 140th and 141st days of the year (there is a two days shift because
it is a leap year, for other years I have a one day shift).
I tried the default origin when I use the dates function but I get the same
results.
Did anyone have this problem before ? I would appreciate some help,
Thank you very much,
Emmanuel
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html