diff --git a/NAMESPACE b/NAMESPACE index 9e25df56..bf4cc159 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -96,6 +96,7 @@ S3method(new_data,tbl_ts) S3method(obj_print_data,yearmonth) S3method(obj_print_data,yearquarter) S3method(obj_print_data,yearweek) +S3method(plot,tbl_ts) S3method(scan_gaps,tbl_ts) S3method(select,grouped_ts) S3method(select,tbl_ts) diff --git a/R/utils.R b/R/utils.R index a7a130f1..2dddb7a9 100644 --- a/R/utils.R +++ b/R/utils.R @@ -78,3 +78,10 @@ format_tz <- function(x) { tz } } + +#' @export +plot.tbl_ts <- function(x, ...) { + message ("The 'autoplot' function from the 'feasts' package is ", + "recommended for plotting 'tsibble' objects") + plot.default(x, ...) +} diff --git a/tests/testthat/test-print.R b/tests/testthat/test-print.R index ae1f26d1..de413782 100644 --- a/tests/testthat/test-print.R +++ b/tests/testthat/test-print.R @@ -48,3 +48,11 @@ test_that("tbl_sum.grouped_ts()", { ) ) }) + +test_that("plot message issued", { + expect_message( + plot(pedestrian), + paste0 ("The 'autoplot' function from the 'feasts' package is ", + "recommended for plotting 'tsibble' objects") + ) +})