Skip to content

Commit

Permalink
uses delayedAssignment() for building empty_df (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarbone committed Jan 27, 2025
1 parent 8353807 commit cf93e94
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions R/data-frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ quick_df <- function(x = NULL) {
#' @export
#' @rdname quick_df
empty_df <- function() {
struct(list(), "data.frame", row.names = integer(), names = character())
.empty_df
}

.empty_df <- structure(
list(),
class = "data.frame",
names = character(),
row.names = integer()
# pre-build a `data.frame` with the `struct()` utility from fuj. Is this
# really necessary? Only if we want the absolute best times for
.empty_df <- NULL
delayedAssign(
".empty_df",
struct(list(), "data.frame", row.names = integer(), names = character())
)

#' @export
Expand Down

0 comments on commit cf93e94

Please sign in to comment.