Add "row names" to Data viewer and extend support to other objects such as xts
It will be a great addition for packages such as zoo and xts that use data.frames/matrix and leverage row names attributes.
Including a filter / sorting / aggregation may also be great in general for rownames.
So far the Data viewer dont allow any filtering at all.
We currently look for the row.names attribute when querying info for the data explorer:
https://github.com/posit-dev/ark/blob/75de9287cbfc6fd53e2bf7189cb5f0b7d743fcc3/crates/ark/src/data_explorer/r_data_explorer.rs#L1035-L1052
We could special case it to use index when dealing with xts/zoo objects.
To add support for filtering we'd want to make sure xts/zoo objects are treated as numbers here:
https://github.com/posit-dev/ark/blob/1c8817c664c3fa6f50d8e12b8421509dabe3063b/crates/ark/src/data_explorer/r_data_explorer.rs#L1091-L1102
I believe that zoo/xta support would be a great enabler for econometric and financial applications.
Thanks for you answer
This came up in discussions here: https://github.com/posit-dev/positron/discussions/4315
We currently look for the
row.namesattribute when querying info for the data explorer:https://github.com/posit-dev/ark/blob/75de9287cbfc6fd53e2bf7189cb5f0b7d743fcc3/crates/ark/src/data_explorer/r_data_explorer.rs#L1035-L1052
We could special case it to use
indexwhen dealing withxts/zooobjects.To add support for filtering we'd want to make sure
xts/zooobjects are treated as numbers here:https://github.com/posit-dev/ark/blob/1c8817c664c3fa6f50d8e12b8421509dabe3063b/crates/ark/src/data_explorer/r_data_explorer.rs#L1091-L1102
I have noticed now Positron can't display rownames of matrix. Could you add support of dimnames attribute in the future? Many old packages still depend this as a variable to perform analysis... If explorer can show this, will be greately helpful. Thanks.
The matrix looks like:
> attributes(m)
$dim
[1] 2 3
$dimnames
$dimnames[[1]]
[1] "Row1" "Row2"
$dimnames[[2]]
[1] "Col1" "Col2" "Col3"
But row names can't display.
That sounds reasonable to me! I think adding support for dimnames should be straigthforward by making sure we also check for dimnames in:
https://github.com/posit-dev/ark/blob/334d8c93fe2456749e48e483caa7283123c23d6d/crates/ark/src/data_explorer/r_data_explorer.rs#L1006
@ZhimingYe I opened a new issue https://github.com/posit-dev/positron/issues/6287 to separate from the original XTS support request.