Skip to content

Bug with the matrix class such that attributes cannot be set #273

Open
@pachadotdev

Description

@pachadotdev

Such as it's the case for names(), it would be extremely convenient to have rownames() and colnames() in cpp codes.

My idea (sorry that I don't enough C++) would be like:

// THIS WORKS
[[cpp11::register]]
doubles cpp_names(writable::doubles X) {
    X.attr("names") = {"a","b"};
    return X;
}

// THIS WON'T
// [[cpp11::register]]
// doubles_matrix<> cpp_colnames(writable::doubles_matrix<> X) {
//     writable::list dimnames;
//     dimnames.push_back(NULL);
//     dimnames.push_back({"a","b"});
//     X.attr("dimnames") = dimnames;
//     return X;
// }

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