Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Bug with the matrix class such that attributes cannot be set

Open
#273 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, r
Domain
tooling

Research direction

Start by tracing matrix class handling for attr("dimnames") and compare it with the working cpp_names example. Reproduce the commented cpp_colnames case and verify that matrix attributes can be assigned while preserving the expected row and column names.

Written by the indexing model from the issue text.

Description

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;
// }
Dominant language
C++
Stars
224
Forks
52
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/cpp11

All issues in r-lib/cpp11

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.