Closed ethanbsmith closed 1 year ago
Thanks for the report. I consider this a bug. Do you have thoughts about how to fix?
I guess n=0 could return NA or NULL
My prior is to return the same as x[0,]. I could be convinced otherwise...
My prior is to return the same as x[0,]. I could be convinced otherwise...
I think that's a good solution. So no error, but no data other than column names.
agree with x[0,]
as output
I haven't looked at the code yet, but will do so this weekend, see if i can come up with a PR or at least suggestions
also, I'd like to loop in @jangorecki and the data.table folks as they have special handling for overiding these functions https://github.com/Rdatatable/data.table/issues/4053
i've taken a stab at the unit test and changes to first.r
https://github.com/joshuaulrich/xts/compare/master...ethanbsmith:fix_350
could you take a look and give any feedback before i start on last.r
When x
is an xts object, data.table::first()
and data.table::last()
call xts::first()
and xts::last()
, respectively. data.table will also call the xts functions if x
isn't an xts object, but the xts package has been attached.
@ethanbsmith your patch looked good to me, so I made the necessary changes to last.R
. Thanks a ton for writing unit tests for both!
Description
i'm not sure if this is a bug or intended behavior. its not what I expected if this is not a bug, could you help me understand why not so we can possibly enhance the docs
thx
Expected behavior
when n = 0 i expect an empty set top be returned
Minimal, reproducible example
Session Info