-
Notifications
You must be signed in to change notification settings - Fork 0
NA support in frollmax #7
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
Changes from all commits
cca5b79
14555b2
437b928
2fd0faf
6c3201a
4a6f063
feef63d
63ea485
63f2e7d
5341409
c4675be
ccd5c43
2494b97
77a01e7
311d12f
2a54cfd
5a52167
cab28b5
161f9f5
fc69835
6c25f5f
dd72ba0
fa36f41
1e8117f
2f326de
911968f
4ce502c
f40aad4
424090c
863538a
f213bec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -34,7 +34,7 @@ partial2adaptive = function(x, n, align) { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| froll = function(fun, x, n, fill=NA, algo=c("fast", "exact"), align=c("right", "left", "center"), na.rm=FALSE, hasNA=NA, adaptive=FALSE, partial=FALSE) { | ||||||
| froll = function(fun, x, n, fill=NA, algo=c("fast","exact"), align=c("right","left","center"), na.rm=FALSE, hasNA=NA, adaptive=FALSE, partial=FALSE) { | ||||||
| stopifnot(!missing(fun), is.character(fun), length(fun)==1L, !is.na(fun)) | ||||||
| algo = match.arg(algo) | ||||||
| align = match.arg(align) | ||||||
|
|
@@ -68,17 +68,17 @@ froll = function(fun, x, n, fill=NA, algo=c("fast", "exact"), align=c("right", " | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| frollmean = function(x, n, fill=NA, algo=c("fast", "exact"), align=c("right", "left", "center"), na.rm=FALSE, hasNA=NA, adaptive=FALSE, partial=FALSE) { | ||||||
| frollmean = function(x, n, fill=NA, algo=c("fast","exact"), align=c("right","left","center"), na.rm=FALSE, hasNA=NA, adaptive=FALSE, partial=FALSE) { | ||||||
| froll(fun="mean", x=x, n=n, fill=fill, algo=algo, align=align, na.rm=na.rm, hasNA=hasNA, adaptive=adaptive, partial=partial) | ||||||
| } | ||||||
| frollsum = function(x, n, fill=NA, algo=c("fast","exact"), align=c("right", "left", "center"), na.rm=FALSE, hasNA=NA, adaptive=FALSE, partial=FALSE) { | ||||||
| frollsum = function(x, n, fill=NA, algo=c("fast","exact"), align=c("right","left","center"), na.rm=FALSE, hasNA=NA, adaptive=FALSE, partial=FALSE) { | ||||||
| froll(fun="sum", x=x, n=n, fill=fill, algo=algo, align=align, na.rm=na.rm, hasNA=hasNA, adaptive=adaptive, partial=partial) | ||||||
| } | ||||||
| frollmax = function(x, n, fill=NA, algo=c("fast", "exact"), align=c("right", "left", "center"), na.rm=FALSE, hasNA=NA, adaptive=FALSE, partial=FALSE) { | ||||||
| frollmax = function(x, n, fill=NA, algo=c("fast","exact"), align=c("right","left","center"), na.rm=FALSE, hasNA=NA, adaptive=FALSE, partial=FALSE) { | ||||||
| froll(fun="max", x=x, n=n, fill=fill, algo=algo, align=align, na.rm=na.rm, hasNA=hasNA, adaptive=adaptive, partial=partial) | ||||||
| } | ||||||
|
|
||||||
| frollapply = function(x, n, FUN, ..., fill=NA, align=c("right", "left", "center"), adaptive=FALSE, partial=FALSE) { | ||||||
| frollapply = function(x, n, FUN, ..., fill=NA, align=c("right","left","center"), adaptive=FALSE, partial=FALSE) { | ||||||
| FUN = match.fun(FUN) | ||||||
| align = match.arg(align) | ||||||
| if (isTRUE(partial)) { | ||||||
|
|
@@ -91,12 +91,14 @@ frollapply = function(x, n, FUN, ..., fill=NA, align=c("right", "left", "center" | |||||
| n = partial2adaptive(x, n, align) | ||||||
| adaptive = TRUE | ||||||
| } | ||||||
| if (isTRUE(adaptive) && base::getRversion() < "3.4.0") ## support SET_GROWABLE_BIT | ||||||
| stopf("frollapply adaptive=TRUE requires at least R 3.4.0"); # nocov | ||||||
| leftadaptive = isTRUE(adaptive) && align=="left" | ||||||
| if (leftadaptive) { | ||||||
| verbose = getOption("datatable.verbose") | ||||||
| rev2 = function(x) if (is.list(x)) lapply(x, rev) else rev(x) | ||||||
| if (verbose) | ||||||
| cat("froll: adaptive=TRUE && align='left' pre-processing for align='right'\n") | ||||||
| cat("frollapply: adaptive=TRUE && align='left' pre-processing for align='right'\n") | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are multiple places for updates like that. As I move forward with next PRs on each one there is more and more conflicts to resolve, conflicts accumulates. Therefore to avoid more conflicts for next PRs I will put it on a list of follow up things to do, once all PRs are in. |
||||||
| x = rev2(x) | ||||||
| n = rev2(n) | ||||||
| align = "right" | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just bump to 3.4.0 dependency for 1.18.0: Rdatatable#6840
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be rewritten in Rdatatable#5575 and then it will also work on < 3.4.0 but with an extra copy on each iteration.