Skip to content

Commit a662092

Browse files
committed
Use rbind.data.frame to avoid method dispatch
1 parent dd899d1 commit a662092

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

R/group2NA.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ group2NA <- function(data, groupNames = "group", nested = NULL, ordered = NULL,
5454
for (i in c(nested, groupNames)) {
5555
data <- dplyr::group_by_(data, i, add = TRUE)
5656
}
57+
# TODO: this is slow, can it be done with dplyr::slice()?
5758
d <- if (retrace.first) {
58-
dplyr::do(data, rbind(., .[1,], NA))
59+
dplyr::do(data, rbind.data.frame(., .[1,], NA))
5960
} else {
60-
dplyr::do(data, rbind(., NA))
61+
dplyr::do(data, rbind.data.frame(., NA))
6162
}
6263
# TODO: how to drop the NAs separating the nested values? Does it even matter?
6364
# d <- dplyr::ungroup(d)

0 commit comments

Comments
 (0)