Skip to content

Commit

Permalink
Remove data.table auto-convert examples
Browse files Browse the repository at this point in the history
  • Loading branch information
markfairbanks committed Dec 18, 2023
1 parent 0ef3c90 commit ebe44e0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
17 changes: 1 addition & 16 deletions R/step-first.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,6 @@
#' @examples
#' library(dplyr, warn.conflicts = FALSE)
#'
#' # If you have a data.table, using it with any dplyr generic will
#' # automatically convert it to a lazy_dt object
#' dt <- data.table::data.table(x = 1:10, y = 10:1)
#' dt %>% filter(x == y)
#' dt %>% mutate(z = x + y)
#'
#' # Note that dtplyr will avoid mutating the input data.table, so the
#' # previous translation includes an automatic copy(). You can avoid this
#' # with a manual call to lazy_dt()
#' dt %>%
#' lazy_dt(immutable = FALSE) %>%
#' mutate(z = x + y)
#'
#' # If you have a data frame, you can use lazy_dt() to convert it to
#' # a data.table:
#' mtcars2 <- lazy_dt(mtcars)
#' mtcars2
#' mtcars2 %>% select(mpg:cyl)
Expand All @@ -61,7 +46,7 @@
#' filter(mpg < mean(mpg)) %>%
#' summarise(hp = mean(hp))
lazy_dt <- function(x, name = NULL, immutable = TRUE, key_by = NULL) {
# in case `x` has an `as.data.table()` method but not a `group_vars()` method
# in case `x` has an `as.data.table()` method but not a `group_vars()` method
groups <- tryCatch(group_vars(x), error = function(e) character())

if (!is.data.table(x)) {
Expand Down
15 changes: 0 additions & 15 deletions man/lazy_dt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ebe44e0

Please sign in to comment.