0

I just create a plot and I am trying to display the trend of the ts, but it gives me an error.

Department_sales_df <- read.csv("DepartmentStoreSales.csv")

Department_sales_ts <- ts(data = Department_sales_df$Sales,
                          start = c(2000, 1), end = c(2005, 4), frequency = 4)

plot(Department_sales_ts, xlab = "Year", ylab = "Sales", main = "Store Sales",
     ylim = c(45000, 105000))

trend_benchmark <- ma(Department_sales_ts, order = 4, centre = TRUE)

Error in ma(Department_sales_ts, order = 4, centre = TRUE) : could not find function "ma"

  • Does `ma` come from the `forecast` package? You appear not to have loaded the package with `library(forecast)`... – Limey Sep 28 '22 at 09:36
  • Ups, thank you very much, I was trying to search the package of ma function in google but I wasn't finding anything. Sorry about that! – Pepe Cobos Sep 28 '22 at 09:41
  • For searching R package information, I tend to quote R and cran and the function I'm looking for. It doesn't always return the package near the top of the list, but it often gives _something_ eventually. Here, [`"r" "cran" "ma"`](https://www.google.com/search?q=%22r%22+%22cran%22+%22ma%22) does eventually suggest the `forecast` package. (The quotes mean "required".) – r2evans Sep 28 '22 at 09:49

0 Answers0