Giter Site home page Giter Site logo

Comments (3)

wlandau avatar wlandau commented on May 29, 2024 2

This edge case happens because tar_map() uses targets::tar_deparse_safe() to sanitize what you supply to values in tar_map(). This is a special wrapper around deparse() which effectively sets the control argument to c("keepNA", "keepInteger"). This causes a different set of behaviors than the default deparse() which makes tracking R code for changes more robust in response to user code and less likely to break across different versions of R. That changes how the 64-bit integer class is deparsed.

deparse(bit64::as.integer64(1))
#> [1] "structure(4.94065645841247e-324, class = \"integer64\")"
deparse(bit64::as.integer64(1), control = c("keepNA", "keepInteger"))
#> [1] "4.94065645841247e-324"

Nothing in metaprogramming works for every edge case, which is why the tar_map() help file cautions against passing complicated objects into values.

tarchetypes/R/tar_map.R

Lines 32 to 38 in 507d06b

#' in place of those symbols. Elements of the `values` list
#' should be small objects that can easily deparse to names,
#' such as characters, integers, and symbols.
#' For more complicated elements of `values`, such as
#' lists with multiple numeric vectors,
#' `tar_map()` attempts to parse the elements into expressions,
#' but this process is not perfect, and the default

tar_meta() tries to create runnable code, so it is best to supply simple objects that can be easily inserted into R expressions without issue.

from tarchetypes.

psychelzh avatar psychelzh commented on May 29, 2024

Or is this by design? If so, is there any workaround other than converting it to character manually beforehand?

from tarchetypes.

psychelzh avatar psychelzh commented on May 29, 2024

Thanks for explaining.

from tarchetypes.

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.