Coder Social home page Coder Social logo

Comments (1)

eddelbuettel avatar eddelbuettel commented on May 28, 2024

That's an R thing I can do nothing about. A vector is forced / required / defined to be of one type, and (AFAIK) the first value determines the type for the whole vector. anytime() and anydate() then receive that vector (as a whole) and do operations given the representation type of the vector.

I am fairly sure we discussed this here before so you may additional information if you search among the closed issues.

The other issue is that initially we took a numeric (as in your vec2) to be a 'transcribed' character (as here) and reconverted to char. Turns out that is a bad idea because we really need to be like R itself and treat 5 (or 5L) as the offset to the epoch so that anydate(5) gets us Jan 6, 1970. But because honour old behaviour and APIs we added an option oldHeuristic -- but apparently only for anytime:

> anytime(20120213, oldHeuristic=TRUE)      
 [1] "2012-02-13 CST"                                      
 > 

If you want to port that to anydate or shimmy something else in please follow up with a proposal. Otherwise I think we can close this. If you disagree, or have other material, please feel free to reopen. Thanks of trying anytime !

PS This works:

> anydate(anytime(20120213, oldHeuristic=TRUE))   
 [1] "2012-02-13"                                                          
 >  

PPS I was not quite correct on oldHeuristic. It is related to char <-> numeric but the values you have here don't fly, we get bad values. The overall issue remains: you may need to take care of leading NA values.

from anytime.

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.