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

transpose() on invalid data should result in error, not warning #164

Closed
huftis opened this issue Jan 13, 2016 · 1 comment
Closed

transpose() on invalid data should result in error, not warning #164

huftis opened this issue Jan 13, 2016 · 1 comment
Labels
bug

Comments

@huftis
Copy link
Contributor

@huftis huftis commented Jan 13, 2016

As discussed at http://blog.rstudio.org/2016/01/06/purrr-0-2-0/#comment-20462 running transpose() on lists of non-conforming dimensions should result in an error, not a warning.

Currently, the following leads to an empty $error element (and a $result element where the z data in the original object has disappeared):

x = rerun(5, x = runif(1), y = runif(5))
x[[4]]$z = 3:5
safely(transpose)(x)
@hadley
Copy link
Member

@hadley hadley commented Mar 5, 2017

This is a worse case of the same basic problem:

library(purrr)

transpose(list(
  list(x = 1, y = 2),
  list(y = 2, x = 1)
))
#> $x
#> $x[[1]]
#> [1] 1
#> 
#> $x[[2]]
#> [1] 2
#> 
#> 
#> $y
#> $y[[1]]
#> [1] 2
#> 
#> $y[[2]]
#> [1] 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants