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..5fd5dd74e 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -329,12 +329,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