R/legacy.R

Defines functions df_as_one_GRP fast_intersect fast_setdiff reconstruct.default reconstruct

#' @noRd

# Legacy functions to not break dependencies ------------------------------

reconstruct <- function(template, data, copy_extra_attributes = TRUE){
  UseMethod("reconstruct")
}
#' @export
reconstruct.default <- function(template, data, copy_extra_attributes = TRUE){
  cheapr::rebuild(data, template)
  # out <- cheapr::rebuild(data, template)
  # if (copy_extra_attributes){
  #   attrs <- attributes(template)
  #   nms <- names(attrs)
  #   nms <- setdiff(nms, c("names", "dim", "dimnames", "row.names", "comment", "class", "tsp", "groups", "GRP"))
  #   if (length(nms) > 0){
  #     # `mostattributes<-`(out, c(attributes(out), attrs[nms]))
  #     attributes(out) <- c(attributes(out), attrs[nms])
  #   }
  # }
  # out
}

df_rep <- cheapr::cheapr_rep
df_rep_each <- cheapr::cheapr_rep_each
df_init <- na_init
df_row_slice <- cheapr::sset
df_add_cols <- cheapr::df_modify

fast_setdiff <- function(x, y){
  x[match(x, y, 0L) == 0L]
}
fast_intersect <- function(x, y){
  x[match(x, y, 0L) != 0L]
}

df_as_one_GRP <- function(data, order = TRUE, return.order = TRUE){
  grouped_df_as_GRP(f_ungroup(data))
}

Try the fastplyr package in your browser

Any scripts or data that you put into this service are public.

fastplyr documentation built on June 8, 2025, 11:18 a.m.