diff --git a/DESCRIPTION b/DESCRIPTION index ff326321a..997603163 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,6 +37,7 @@ Imports: Suggests: bookdown, cyclocomp, + data.table, jsonlite, patrick (>= 0.2.0), rlang, @@ -46,8 +47,6 @@ Suggests: tibble, tufte, withr (>= 2.5.0) -Enhances: - data.table VignetteBuilder: knitr Config/Needs/website: tidyverse/tidytemplate diff --git a/NAMESPACE b/NAMESPACE index 3126b16ad..d7089a304 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ S3method("[",lints) S3method(as.data.frame,lints) +S3method(data.table::as.data.table,lints) S3method(format,lint) S3method(format,lints) S3method(names,lints) @@ -9,6 +10,7 @@ S3method(print,lint) S3method(print,lints) S3method(split,lints) S3method(summary,lints) +S3method(tibble::as_tibble,lints) export(Lint) export(Linter) export(T_and_F_symbol_linter) diff --git a/R/methods.R b/R/methods.R index 7a8fe3cc1..211222a58 100644 --- a/R/methods.R +++ b/R/methods.R @@ -173,6 +173,7 @@ as.data.frame.lints <- function(x, row.names = NULL, optional = FALSE, ...) { # ) } +#' @exportS3Method tibble::as_tibble as_tibble.lints <- function(x, ..., # nolint: object_name_linter. .rows = NULL, .name_repair = c("check_unique", "unique", "universal", "minimal"), @@ -181,6 +182,7 @@ as_tibble.lints <- function(x, ..., # nolint: object_name_linter. tibble::as_tibble(as.data.frame(x), ..., .rows = .rows, .name_repair = .name_repair, rownames = rownames) } +#' @exportS3Method data.table::as.data.table as.data.table.lints <- function(x, keep.rownames = FALSE, ...) { # nolint: object_name_linter. stopifnot(requireNamespace("data.table", quietly = TRUE)) data.table::setDT(as.data.frame(x), keep.rownames = keep.rownames, ...) diff --git a/R/zzz.R b/R/zzz.R index e281353db..efff93b2f 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -330,11 +330,5 @@ settings <- new.env(parent = emptyenv()) reset_settings() - if (requireNamespace("tibble", quietly = TRUE)) { - registerS3method("as_tibble", "lints", as_tibble.lints, asNamespace("tibble")) - } - if (requireNamespace("data.table", quietly = TRUE)) { - registerS3method("as.data.table", "lints", as.data.table.lints, asNamespace("data.table")) - } } # nocov end