-
Notifications
You must be signed in to change notification settings - Fork 185
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
New linter to recommend list2DF()
base R function
#2596
Comments
x <- list(ind = 1:2, let = letters[1:6])
try(list2DF(x))
#> Error in list2DF(x) : all variables should have the same length do.call(cbind.data.frame, x)
#> ind let
#> 1 1 a
#> 2 2 b
#> 3 1 c
#> 4 2 d
#> 5 1 e
#> 6 2 f even length 1 not recycled x <- list(ind = 1, let = letters[1:6])
try(list2DF(x))
#> Error in list2DF(x) : all variables should have the same length do.call(cbind.data.frame, x)
#> ind let
#> 1 1 a
#> 2 1 b
#> 3 1 c
#> 4 1 d
#> 5 1 e
#> 6 1 f |
In that case it makes it tough to recommend I do see a surprising number of call sites for So we could recommend just using |
Is there different behavior of |
Here's function (..., deparse.level = 1)
data.frame(..., check.names = FALSE)
<bytecode: 0x55bca92f06a0>
<environment: namespace:base> 🙃 |
As an alternative to
do.call(cbind.data.frame, x)
.Created on 2024-06-07 with reprex v2.1.0
Some hits in the wild: https://github.com/search?q=org%3Acran+%2Fdo%5C.call%5C%28cbind%5C.data%5C.frame%2F&type=code
Are there some edge cases one needs to be aware of? Happy to submit a PR for this.
The text was updated successfully, but these errors were encountered: