Giter Club home page Giter Club logo

Comments (5)

wch avatar wch commented on July 22, 2024

It looks like the problem is happening because sometimes the breaks have negative years, and as.Date() doesn't handle these well.

x <- as.Date(c("0001-01-24", "0500-02-02"))
as.character(x)
# "0001-01-24" "0500-02-02"
as.Date(as.character(x))

# Minus 391 days gives negative year
as.character(x - 391)
# "-001-12-30" "0499-01-07"
as.Date(as.character(x - 391))
# Error during wrapup: character string is not in a standard unambiguous format

from scales.

smu avatar smu commented on July 22, 2024

A right, I forgot that I asked about this on r-help [1], but never got an answer.
In this case it is a bug in R?

[1] http://r.789695.n4.nabble.com/Date-object-and-origin-BC-tp4173163.html

from scales.

wch avatar wch commented on July 22, 2024

I just asked the same thing on r-devel, but no helpful replies yet.

https://stat.ethz.ch/pipermail/r-devel/2012-July/064398.html

It might be a "feature" instead of a bug, at least to the core R developers.

from scales.

hadley avatar hadley commented on July 22, 2024

Fixing this is going to be hard - I think it you could extract the necessary bits out of cut.Date() but it seems like a lot of work for little gain.

from scales.

MicheleCazzola avatar MicheleCazzola commented on July 22, 2024

Same problem, found solution here: https://www.r-bloggers.com/2021/09/error-in-character-string-is-not-in-a-standard-unambiguous-format/

from scales.

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.