Skip to content

Add support for decimal data type #65

@mstackhouse

Description

@mstackhouse

The numeric precision under the hood in the yyjson library is less than we'd like it to be, and in testing precision starts falling apart around 7 decimal places. The Dataset JSON standard has the "decimal" datatype available to allow users to intentionally handle floating point values. The package should support the ability to write and read these values.

This feature can be implemented as follows:

  • Add option to write_dataset_json() "floats_as_decimals"
  • Add additional option to control the specific number of digits to write
  • Pull out all float variables from the columns tables
  • Update the metadata for these variables to have dataType=decimal and targetDataType=decimal in line with guidance
  • Loop and rewrite all those columns as character using format(x, digits=digits)
  • Add option to read_dataset_json() "decimals_as_numeric"
  • On read, identify all decimal columns and convert using as.numeric()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions