Skip to content
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

Make all methods S3-methods, for easier integration with other packages e.g. disk.frame #9

Closed
xiaodaigh opened this issue Nov 30, 2019 · 3 comments · Fixed by #11
Closed
Assignees
Labels
feature New feature or request

Comments

@xiaodaigh
Copy link

I want to support tidyfast's verbs with disk.frame but I would need the verbs to be S3-compatible.

E.g. your code would beccome

dt_count <- function(dt, ....) {
   UseMethod("dt_count")
}

dt_count.default <- function(dt_, ..., na.rm = FALSE, wt = NULL){

  if (isFALSE(is.data.table(dt_)))
    .dt <- as.data.table(dt_)

  dots <- substitute(list(...))
  wt <- substitute(wt)

  if (na.rm)
    dt_ <- dt_[complete.cases(dt_)]

  if (!is.null(wt))
    return(dt_[, list(N = sum(eval(wt))), keyby = eval(dots)])

  dt_[, .N, keyby = eval(dots)]
}

So in disk.frame, I would implement

dt_count.disk.frame(dt, ...) {
...
}

That way, we can enable tidyfast verbs to be used with large on-disk datasets :)

Relevant issue: DiskFrame/disk.frame#218

@TysonStanley
Copy link
Owner

Oh, that'd be great having support from {diskframe}. That'll be the next thing I work on. Will update you when ready.

This was referenced Nov 30, 2019
@TysonStanley TysonStanley self-assigned this Nov 30, 2019
@TysonStanley TysonStanley added the feature New feature or request label Nov 30, 2019
@TysonStanley
Copy link
Owner

Should be ready for you!

@xiaodaigh
Copy link
Author

WIP PR to integrate tidyfast with disk.frame

DiskFrame/disk.frame#220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
2 participants