You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you call as_tibble() without any arguments, it creates an empty tibble. This is a desired behavior for tibble() but I can't imagine a scenario when someone intentionally wants to create an empty tibble using as_tibble().
as_tibble()
# A tibble: 0 x 0
The analogous function from base R is as.data.frame(), which throws an error when called without parameters.
as.data.frame()
#Error in as.data.frame() : argument "x" is missing, with no default
This isn't really a bug since the problem results from a mistake in writing code. I noticed it when I forgot to add a pipe in a chain of operations. Below is a convoluted example. You shouldn't necessarily try to protect us from ourselves. But I figured it was still worth documenting.
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.
When you call as_tibble() without any arguments, it creates an empty tibble. This is a desired behavior for tibble() but I can't imagine a scenario when someone intentionally wants to create an empty tibble using as_tibble().
as_tibble() # A tibble: 0 x 0
The analogous function from base R is as.data.frame(), which throws an error when called without parameters.
as.data.frame() #Error in as.data.frame() : argument "x" is missing, with no default
This isn't really a bug since the problem results from a mistake in writing code. I noticed it when I forgot to add a pipe in a chain of operations. Below is a convoluted example. You shouldn't necessarily try to protect us from ourselves. But I figured it was still worth documenting.
You might consider adding a warning.
as_tibble() # Warning: as_tibble() called without any arguments. Empty tibble returned. To avoid this warning, call tibble() instead of as_tibble().
The text was updated successfully, but these errors were encountered: