Thanks to Kurt Hornik for this report! xts will fail R CMD check on recent R-devel if run with: _R_CHECK_LENGTH_1_LOGIC2_=package:_R_CHECK_PACKAGE_NAME_,abort,verbose
The lines that triggers the error is in test.i_invalid_date_string():
x <- xts(1:10, as.Date("2015-02-20")+0:9)
y <- x["2015-02-30"] # error triggered in .parseISO8601() called here
The specific line in .parseISO8601() is:
if(is.na(s) && is.na(e) && !nzchar(DURATION) && intervals != "").
This is because intervals is only length-1 and equal to "" when [.xts is called with a value for i that is only a separator (e.g. "/" or "::").
The printed values after each call are some examples of the values of intervals during different subset calls:
R> y <- x["/",]
[1] ""
R> y <- x["/2015",]
[1] "" "2015"
R> y <- x["2015/",]
[1] "2015"
R> y <- x["2015-02-28",]
[1] "2015-02-28" "2015-02-28"
R> y <- x["2015-02-30",]
[1] "2015-02-30" "2015-02-30"
Thanks to Kurt Hornik for this report! xts will fail
R CMD check
on recent R-devel if run with:_R_CHECK_LENGTH_1_LOGIC2_=package:_R_CHECK_PACKAGE_NAME_,abort,verbose
The lines that triggers the error is in
test.i_invalid_date_string()
:The specific line in
.parseISO8601()
is:if(is.na(s) && is.na(e) && !nzchar(DURATION) && intervals != "")
.This is because
intervals
is only length-1 and equal to""
when[.xts
is called with a value fori
that is only a separator (e.g."/"
or"::"
).The printed values after each call are some examples of the values of
intervals
during different subset calls: