We can make the as.data.frame() for the unnest = FALSE case simpler and quite a bit faster with either using NextMethod() (~9µs, should be dispatched to list method) or vctrs::new_data_frame() or vctrs::data_frame() most packages building custom vctrs types seem to use vctrs::new_data_frame():
Then it would something like the following for the unnest = FALSE case or substituting with equivalent vctrs code from above instead of the NextMethod call:
We can make the
as.data.frame()
for theunnest = FALSE
case simpler and quite a bit faster with either usingNextMethod()
(~9µs, should be dispatched to list method) orvctrs::new_data_frame()
orvctrs::data_frame()
most packages building custom vctrs types seem to usevctrs::new_data_frame()
:Created on 2024-06-15 with reprex v2.1.0
Then it would something like the following for the
unnest = FALSE
case or substituting with equivalent vctrs code from above instead of theNextMethod
call: