-
Notifications
You must be signed in to change notification settings - Fork 272
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
Unexpected behavior of flatten_dfr #377
Comments
And the function will report error if the input is a list of matrix.
|
data.frame and matrix are different things in terms of data structure, so I feel it is natural that is(do.call(rbind, list(c(1, 2), c(3, 4))))
#> [1] "matrix" "array" "structure" "vector" @elong0527 x %>% map(as.data.frame) %>% flatten_dfr(.id = "id")
#> # A tibble: 2 x 5
#> id Estimate `Std. Error` `t value` `Pr(>|t|)`
#> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0.09920347 0.5399731 0.1837193 0.8631710
#> 2 1 -0.14516082 0.6164339 -0.2354848 0.8253975
x %>% map_dfr(as.data.frame, .id = "id")
#> id Estimate Std. Error t value Pr(>|t|)
#> 1 0 -1.14290763 0.4655154 -2.4551444 0.1334761
#> 2 0 -0.47259892 0.3970154 -1.1903793 0.3560344
#> 3 1 0.09920347 0.5399731 0.1837193 0.8631710
#> 4 1 -0.14516082 0.6164339 -0.2354848 0.8253975 |
Consider the following:
I would expect flatten_dfr(l) == do.call(rbind, l).
The text was updated successfully, but these errors were encountered: