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

Compatibility of the fast alternative of index.xts #2

Closed
yinhm opened this issue Mar 16, 2012 · 3 comments
Closed

Compatibility of the fast alternative of index.xts #2

yinhm opened this issue Mar 16, 2012 · 3 comments

Comments

@yinhm
Copy link

yinhm commented Mar 16, 2012

Hi,

I try to using SIT with other packages as well, unfortunately it breaks my exists code due to compatibility of the fast alternative of index.xts.

Error in `[.xts`(data, timestamp) : subscript out of bounds
In addition: Warning messages:

Removing the following function everything works smoothly.

###############################################################################
# Fast alternative to index(x) for XTS object
###############################################################################
index.xts <- function
(
    x           # XTS object
)
{
    temp = attr(x, 'index')
    class(temp)='POSIXct' 

    if( attr(x, '.indexCLASS')[1] == 'Date') {  
        as.Date(temp)
    } else {
        as.POSIXct(temp, tz = Sys.getenv('TZ'))
    }
}
@systematicinvestor
Copy link
Owner

Please provide a concrete code example, so I can have a look at this issue.

@yinhm
Copy link
Author

yinhm commented Mar 16, 2012

Sorry I don't have a standalone reproducible example now.

I'm calling R from Python bridged by rpy2, my quotes data feeded from Python to quantstrat for backtesting.

I'm intended to open source it later since it still in heavy development stage also I'm new to R.

Maybe I could do a reproducible example latter.

@systematicinvestor
Copy link
Owner

Let me know when you have an example

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

No branches or pull requests

2 participants