Skip to content
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

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

Closed
EmilHvitfeldt opened this issue Jun 7, 2020 · 2 comments

Comments

@EmilHvitfeldt
Copy link

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)

@krlmlr krlmlr closed this as completed in 2b20fa2 Jun 12, 2020
@krlmlr
Copy link
Member

krlmlr commented Jun 12, 2020

Thanks for reporting!

krlmlr added a commit that referenced this issue Feb 25, 2021
tibble 3.0.2

- `[[` works with classed indexes again, e.g. created with `glue::glue()` (#778).
- `add_column()` works without warning for 0-column data frames (#786).
- `tribble()` now better handles named inputs (#775) and objects of non-vtrs classes like `lubridate::Period` (#784) and `formattable::formattable` (#785).

- Subsetting and subassignment are faster (#780, #790, #794).
- `is.null()` is preferred over `is_null()` for speed.
- Implement continuous benchmarking (#793).

- `is_vector_s3()` is no longer reexported from pillar (#789).
@github-actions
Copy link
Contributor

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants