Code Monkey home page Code Monkey logo

Comments (3)

AdrianAntico avatar AdrianAntico commented on May 13, 2024

@trancuuquoc

My guess is that one of two things are wrong:

  1. You may have not specified the TimeUnit argument correctly. I've seen this error before when I have weekly data and I accidentally specified "day" as the TimeUnit argument.
  2. The inner function CreateHolidayVariables() may not be identifying the date column as a Date or POSIXct type.

I just added in some helper code that should prevent the second error cause from occurring but it won't prevent the error of incorrectly specifying the TimeUnit argument.

from autoquant.

AdrianAntico avatar AdrianAntico commented on May 13, 2024

@trancuuquoc I didn't receive any data via email. Send it to my email: [email protected] and I'll give it a go and see what the issue is and report back.

from autoquant.

AdrianAntico avatar AdrianAntico commented on May 13, 2024

@trancuuquoc

I added the fix. Should work now. You'll have to reinstall the package of course for the changes to take effect.

OLD:
if(is.character(data[[eval(DateColumnName)]])) {
    data[, eval(DateColumnName) := as.Date(get(DateColumnName))]
} else {
  data[, eval(DateColumnName) := as.POSIXct(get(DateColumnName))]
}

NEW:
if (!(tolower(TimeUnit) %chin% c("1min","5min","10min","15min","30min","hour"))) {
  if(is.character(data[[eval(DateColumnName)]])) {
    x <- data[1,get(DateColumnName)]
    x1 <- lubridate::guess_formats(x, orders = c("mdY", "BdY", "Bdy", "bdY", "bdy", "mdy", "dby", "Ymd", "Ydm"))
    data[, eval(DateColumnName) := as.Date(get(DateColumnName), tryFormats = x1)]
  }
} else {
  data[, eval(DateColumnName) := as.POSIXct(get(DateColumnName))]
}

from autoquant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.