add_sa_item: Add a SA-item to a SAProcessing

View source: R/saprocessing.R

add_sa_itemR Documentation

Add a SA-item to a SAProcessing

Description

Add a SA-item to a SAProcessing

Usage

add_sa_item(jsap, name, x, spec)

## S3 method for class 'ts'
add_sa_item(jsap, name, x, spec)

## Default S3 method:
add_sa_item(jsap, name, x, spec)

## S3 method for class 'jobjRef'
add_sa_item(jsap, name, x, spec)

Arguments

jsap

SAProcessing.

name

name of the SA-item to be added.

x

either a seasonal adjustment model (from rjd3x13::x13() or rjd3tramoseats::tramoseats()), a SA-item object, "ts" object.

spec

specification to use when x is a "ts" object.

Value

NULL returned invisibly#'

Examples



dir <- tempdir()

# Raw series
y <- rjd3toolkit::ABS$X0.2.09.10.M

# Creating an empty workspace and SAProcessing
jws <- jws_new()
jsap1 <- jws_sap_new(jws, "sap1")

# Adding SA-item as estimation result


# Estimation with rjd3x13
add_sa_item(jsap1, name = "series_1", x = rjd3x13::x13(y))

# Estimation with rjd3tramoseats
add_sa_item(jsap1, name = "series_2", x = rjd3tramoseats::tramoseats(y))

# Adding SA-item as raw series + specification
add_sa_item(jsap1, name = "series_3", x = y, rjd3x13::x13_spec("RSA3"))
add_sa_item(jsap1, name = "series_4", x = y, rjd3tramoseats::tramoseats_spec("RSAFull"))

jsai1 <- jsap_sai(jsap = jsap1, idx = 1L)
# Adding SA-item from a Workspace
add_sa_item(jsap = jsap1, name = "series_1_bis", x = jsai1)

rws <- read_workspace(jws)
rws$processing$sap1$series_4

# Writing the workspace
save_workspace(jws, file.path(dir, "workspace.xml"))



rjd3workspace documentation built on July 17, 2026, 9:07 a.m.