Skip to content

Consider using S4Vectors::DataFrame instead of data.frame for obs/var #554

Description

@lazappi

Description

We currently use a standard data.frame for obs/var but it has some limitations such as requiring the row names to be unique (see #172, #77).

Switching to the Bioconductor S4Vectors::DataFrame class would fix that issue and potentially help with some other problems.

Activity

  1. added
    design
    triage
    on Oct 25, 2026
  2. added theissue type on Oct 25, 2026
  3. changed the issue type fromtoon Oct 25, 2026
  4. lazappi commented on Oct 25, 2026

    @lazappi
    CollaboratorAuthor

    @rcannood What do you think?

  5. rcannood commented on Oct 25, 2026

    @rcannood
    Member

    Oh, that might be interesting!

    Then Bioc would also finally stop complaining that we don't have any Bioc dependencies :p

    Do S4Vectors::DataFrame's work in the same way as regular data frames? Can you pass them to functions that would regularly expect regular data frames?

  6. lazappi commented on Oct 26, 2026

    @lazappi
    CollaboratorAuthor

    Most of the time yes. You do sometimes need to do something like as.data.frame(df) for things like ggplot(). The behaviour is equivalent so it depends if the function actively checks the class or not.

    They are already used by SingleCellExperiment and other Bioconductor classes so people should be relatively familiar with them.

    Potentially we could have an option to control which kind of data frame is used but I feel like that's just asking for trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    designtriage

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions