R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(fpp2)
## Warning: package 'fpp2' was built under R version 4.1.3
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## -- Attaching packages ---------------------------------------------- fpp2 2.5 --
## v ggplot2   3.5.1      v fma       2.5   
## v forecast  8.23.0     v expsmooth 2.3
## Warning: package 'fma' was built under R version 4.1.3
## Warning: package 'expsmooth' was built under R version 4.1.3
## 
# Frequency of each series
frequency(gold)     # Typically 1 (daily data)
## [1] 1
frequency(woolyrnq) # Quarterly data, frequency = 4
## [1] 4
frequency(gas)      # Monthly data, frequency = 12
## [1] 12

Including Plots

You can also embed plots, for example:

# Find the observation with the maximum value in the gold series
which.max(gold)
## [1] 770
outlier_index <- which.max(gold)
outlier_index
## [1] 770
gold[770]
## [1] 593.7
outlier_value <- gold[outlier_index]
outlier_value
## [1] 593.7
# Print the result
cat("The outlier is at index:", outlier_index, "with value:", outlier_value, "\n")
## The outlier is at index: 770 with value: 593.7

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.