We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dates treated as numeric or character?
Numeric : more speed Character : human-readable
jsonify::to_json( data.frame(dte = as.Date("2018-01-01") ) ) # [1] "[{\"dte\":17532.0}]" jsonify::to_json( jsonify:::handle_dates( data.frame(dte = as.Date("2018-01-01") ) ) ) # [1] "[{\"dte\":\"2018-01-01\"}]"
n <- 1e6 df <- data.frame(id = 1:n, dte = sample(seq(as.Date("2018-01-01"), as.Date("2018-01-31"), length.out = n))) library(microbenchmark) microbenchmark( numeric = { jsonify::to_json( df ) }, character ={ jsonify::to_json( jsonify:::handle_dates( df ) ) }, times = 5 ) # Unit: milliseconds # expr min lq mean median uq max neval # numeric 982.7153 1113.085 1117.633 1140.885 1149.160 1202.320 5 # character 4802.2583 4829.550 5130.051 4916.636 5146.547 5955.265 5
date_as_numeric = TRUE
to_json()
FALSE
handle_dates()
The text was updated successfully, but these errors were encountered:
I'm leaning towards the quickest option as the default, so leaving Dates as numeric, but providing the dates_as_numeric (or similarly named) argument.
Dates
dates_as_numeric
Sorry, something went wrong.
Given this issue & correction , need a robust solution for lists too.
I'm not going to support numeric_dates in lists for v0.1.0.
numeric_dates
lists
No branches or pull requests
Dates treated as numeric or character?
Numeric : more speed
Character : human-readable
Decision
date_as_numeric = TRUE
argument into_json()
. IfFALSE
, usehandle_dates()
The text was updated successfully, but these errors were encountered: