Skip to content

5268_as_xts_support_non_numerics#5276

Merged
mattdowle merged 5 commits intoRdatatable:masterfrom
ethanbsmith:5268-support-non-numeric-types
Dec 2, 2021
Merged

5268_as_xts_support_non_numerics#5276
mattdowle merged 5 commits intoRdatatable:masterfrom
ethanbsmith:5268-support-non-numeric-types

Conversation

@ethanbsmith
Copy link
Copy Markdown
Contributor

@ethanbsmith ethanbsmith commented Dec 1, 2021

allow bypass of numeric only columns
use as.matrix for fast conversion
fixes #5268 (replaces pr: #5270)

@ethanbsmith ethanbsmith changed the title clean pr 5268_as_xts_support_non_numerics Dec 1, 2021
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 1, 2021

Codecov Report

Merging #5276 (b532fb4) into master (154fcf9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head b532fb4 differs from pull request most recent head 1328189. Consider uploading reports for the commit 1328189 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5276   +/-   ##
=======================================
  Coverage   99.50%   99.50%           
=======================================
  Files          77       77           
  Lines       14631    14645   +14     
=======================================
+ Hits        14559    14573   +14     
  Misses         72       72           
Impacted Files Coverage Δ
R/merge.R 100.00% <100.00%> (ø)
R/xts.R 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccda29b...1328189. Read the comment docs.

@mattdowle mattdowle added this to the 1.14.3 milestone Dec 2, 2021
@mattdowle mattdowle merged commit 198f452 into Rdatatable:master Dec 2, 2021
Comment thread R/xts.R
if (!all(colsNumeric)) warningf("Following columns are not numeric and will be omitted: %s", brackify(names(colsNumeric)[!colsNumeric]))
r = setDF(x[, .SD, .SDcols = names(colsNumeric)[colsNumeric]])
return(xts::as.xts(r, order.by = if ("IDate" %chin% class(x[[1L]])) as.Date(x[[1L]]) else x[[1L]]))
r <- x[, -1L]# exclude first col, xts index
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the late review. would it be better to shallow()-copy x and then delete the first column?

Comment thread NEWS.md

51. `merge.data.table()` silently ignored the `incomparables` argument, [#2587](https://github.com/Rdatatable/data.table/issues/2587). It is now implemented and any other ignored arguments (e.g. misspellings) are now warned about. Thanks to @GBsuperman for the report and @ben-schwen for the fix.

52. `as.xts.data.table` now supports non-numeric xts coredata matrixes, [5268](https://github.com/Rdatatable/data.table/issues/5268). Existing numeric only functionality is supported by a new `numeric.only` parameter, which defaults to `TRUE` for backward compatability and the most common use case. To convert non-numeric columns, set this parameter to `FALSE`. Conversions of `data.table` columns to a `matrix` now uses `data.table::as.matrix`, with all its performance benefits. Thanks to @ethanbsmith for the report and fix.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan to support this numeric.only option indefinitely? If not, we should state the migration plan up front.

@ethanbsmith
Copy link
Copy Markdown
Contributor Author

ethanbsmith commented Dec 19, 2021 via email

@ethanbsmith ethanbsmith deleted the 5268-support-non-numeric-types branch January 6, 2022 23:47
@jangorecki jangorecki modified the milestones: 1.14.9, 1.15.0 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

as.xts.data.table is limited to numeric data types, but this is not an xts limitation

4 participants