-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
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
Feature request: support for attributes #30
Comments
Yes, it would be nice to extract attributes. I'm just not sure how they should be returned to the user.
|
Since metadata can be attached arbitrarily to R objects, it seems like we'd either have to defensively wrap every object read from the RDA file on the Julia side in a type that preserves attributes, or live with very severe type instability (i.e. scalar versus |
Definitely true. Personally I am for an extra dedicated function that loads R objects defensively. I have also started a related discussion on Stackoverflow |
For the top level objects, creating special entries in the |
Columns of a dataframe is a good example showing that it would be very hard if possible at all to recover all the attributes while converting R objects into Julia equivalents. In fact, So my vision is that for the There are also some standard R attributes like array "dimnames". I guess, we can implement some There could also be e.g. |
The fact that the default is to silently throw out information -- the attributes -- is not acceptable IMHO. Maybe there should be at least a large warning printed when that happend as a quick in-the-mean-time solution ? The best possible solution IMHO is just to keep these attributes in the returned object, and --if possible-- convert each one of them. This list of attribute is just a name list of R objects after all. Is there a way I could achieve this with the current state of the package ? Can we somehow spit the |
Since this issue was filed, support for metadata was added to DataAPI and DataFrames (JuliaData/DataAPI.jl#48). We could add support for this API to |
basically I am using the following piece of code for the moment : obj = R"myobject"
rez = Dict(
:obj => rcopy(obj),
:class => rcopy(rcall(:class, obj)),
:attrs => rcopy(rcall(:attributes, obj))
) Then every attributes should be converted automatically if they can. Unfortunately, attributes could be anything so this might need to be recursive, checking if there are attributes to the attributes an so on. I am not sure this will be enough to always extract everything however :( Therefore, I would love the final implementation we do here to warn if anything was discarded and is not part of the obtained output. |
I know it can be tough, since Julia doesn't support anything similar, but many people (including me) store important metadata in attributes.
I guess objects' metadata should be inserted as distinct items in the resulting dictionary.
E.g. if I read object
a
generated asthen it should produce dictionary with two entries:
"a" → "Kuku!"
"a|label" → "my label"
Character
|
can be replaced with any other character that cannot occur in variable's name.The text was updated successfully, but these errors were encountered: