Skip to content

rownames_to_column() gives warning if used on data.frame with no columns #786

@EmilHvitfeldt

Description

@EmilHvitfeldt

The title says it all. rownames_to_column() gives a warning if used on data.frame with no columns, but works as intended if there are columns.

library(tibble)

a <- matrix(nrow = 1, ncol = 0)
rownames(a) <- "name"
a_df <- as.data.frame(a)

rownames_to_column(a_df)
#> Warning: The `.data` argument of `add_column()` must have unique names as of tibble 3.0.0.
#> Use `.name_repair = "minimal"`.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.
#>   rowname
#> 1    name

Created on 2020-06-07 by the reprex package (v0.3.0)

library(tibble)

a <- matrix(nrow = 1, ncol = 1)
rownames(a) <- "name"
a_df <- as.data.frame(a)

rownames_to_column(a_df)
#>   rowname V1
#> 1    name NA

Created on 2020-06-07 by the reprex package (v0.3.0)

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