#0 Project: Australian accommodation ################################
#1 Install & Load Packages ################################
install pacman ("package manager") if needed
if (!require("pacman")) install.packages("pacman")Load contributed packages with pacman
pacman::p_load(pacman,feasts,forecast,fpp3,GGally,ggplot2,janitor,lubridate,openxlsx,readxl,styler,survMisc,tidyverse,tsibble)
#2 Tidy: Import,Clean, and Wrange##########################################################################################################
Object_name = data_all=============================================================================
data_all <- aus_accommodation
Object_class=============================================================================
class(data_all)
[1] "tbl_ts" "tbl_df" "tbl" "data.frame"Autoplot=============================================================================
autoplot(data_all,Occupancy)
Error in UseMethod("autoplot") :
no applicable method for 'autoplot' applied to an object of class "c('tbl_ts', 'tbl_df', 'tbl', 'data.frame')"
Loading all those packages may cause some problems. In general, only load what you actually need. This works
library(fpp3)
#> ── Attaching packages ─────────────────────────────────────── fpp3 0.4.0.9000 ──
#> ✔ tibble 3.1.7 ✔ tsibble 1.1.1
#> ✔ dplyr 1.0.9 ✔ tsibbledata 0.4.0
#> ✔ tidyr 1.2.0 ✔ feasts 0.2.2
#> ✔ lubridate 1.8.0 ✔ fable 0.3.1
#> ✔ ggplot2 3.3.6 ✔ fabletools 0.3.2
#> ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
#> ✖ lubridate::date() masks base::date()
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ tsibble::intersect() masks base::intersect()
#> ✖ tsibble::interval() masks lubridate::interval()
#> ✖ dplyr::lag() masks stats::lag()
#> ✖ tsibble::setdiff() masks base::setdiff()
#> ✖ tsibble::union() masks base::union()
aus_accommodation %>%
autoplot(Occupancy)
Created on 2022-05-24 by the reprex package (v2.0.1)
1 Like
Many thanks! Love your fpp3 book btw! Greetings from Spain !
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.