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

allow list_transpose() to work on data frames #1141

Merged
merged 6 commits into from
Aug 20, 2024

Conversation

KimLopezGuell
Copy link
Contributor

Fixed issue #1109

Copy link
Member

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks great!

Do you want to update the documentation of the x argument in the roxygen2 header above? Could you please also add a bullet to NEWS.md ?

@@ -140,3 +140,8 @@ test_that("fail mixing named and unnamed vectors", {
test_list_transpose()
})
})

test_that("works on data frames", {
expect_no_error(list_transpose(mtcars))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a test with a simple data frame or tibble as in the test above?

x <- tibble(list(a = 1, b = 2), list(a = 3, b = 4))
...

@@ -69,7 +69,13 @@ list_transpose <- function(x,
simplify = NA,
ptype = NULL,
default = NULL) {
vec_check_list(x)
if(!is.list(x)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like purrr already had a check_list() so I used it here.

@hadley hadley merged commit 6520dc0 into tidyverse:main Aug 20, 2024
13 checks passed
@hadley
Copy link
Member

hadley commented Aug 20, 2024

Thanks for working on this! I hope you had fun at TDD 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants