Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-Forge #1079] na.locf #28

Closed
joshuaulrich opened this issue Feb 26, 2015 · 0 comments
Closed

[R-Forge #1079] na.locf #28

joshuaulrich opened this issue Feb 26, 2015 · 0 comments
Labels

Comments

@joshuaulrich
Copy link
Owner

Submitted by: Koert Kuipers
Assigned to: Nobody
R-Forge link

R 2.10.1 on Win XP
xts 0.7-5

na.locf doesnt work anymore on xts objects without DIM.

library(xts)
na.locf(zoo())
Data:
numeric(0)

Index:
integer(0)

na.locf(xts())
Error in if (dim(object)[2] > 1) { : argument is of length zero

This wouldn't be an issue if zero row selection did not strip the DIM from an object:

a = xts(1 : 3, order.by = Sys.Date() + 1 : 3)
na.locf(a[a>4])
Error in if (dim(object)[2] > 1) { : argument is of length zero

Any form of batch processing will once in a while create zero row objects. Having the DIM disappear when that happens leads to weird bugs like these in my opinion...
Best,
Koert

Followups:

Date: 2010-09-17 15:29
Sender: Jeff Ryan
Fixed in the newest svn (522)

library(xts)
Loading required package: zoo
na.locf(zoo())
Data:
numeric(0)

Index:
integer(0)

na.locf(xts())
Data:
numeric(0)

Index:
integer(0)

a = xts(1 : 3, order.by = Sys.Date() + 1 : 3)
na.locf(a[a>4])
Data:
integer(0)

Index:
integer(0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant