Learn R Programming

seasonal (version 1.0.0)

import.spc: Import X-13 .spc Files (experimental)

Description

Utility function to import .spc files from X-13. It generates a list of calls to seas (and import.ts) that can be run in R, which should be equivalent to the original .spc file. The print method displays the calls in a way that they can be copy-pasted into an R script.

Usage

import.spc(file)

## S3 method for class 'import.spc': print(x, ...)

Arguments

file
character, name of the X-13 .spc file
x
object of class import.spc
...
further arguments, not used

Value

  • returns an object of class import.spc, which is a list with the following (optional) objects of class call:
  • callthe call to seas
  • xthe call to retrieve the data for the input series
  • xtransthe call to retrieve the data for the xtrans series (if required by the call)
  • xregthe call to retrieve the data for the xreg series (if required by the call)

See Also

import.ts, for importing X-13 data files.

seas for the main function of seasonal.

Examples

Run this code
# importing the orginal X-13 example file
import.spc(file.path(path.package("seasonal"), "tests", "Testairline.spc"))

# a spc with multiple user defined regression and transformation series
tdir <- tempdir()
seas(x = AirPassengers, xreg = cbind(a = genhol(cny, start = 1, end = 4,
    center = "calendar"), b = genhol(cny, start = -3, end = 0,
    center = "calendar")), xtrans = cbind(sqrt(AirPassengers), AirPassengers^3),
    transform.function = "log", transform.type = "temporary",
    regression.aictest = "td", regression.usertype = "holiday", dir = tdir,
    out = TRUE)
ii <- import.spc(file.path(tdir, "iofile.spc"))
ii  # list with 4 calls (3 series import, 1 main call)

# evaluating the imported calls in R
ee <- lapply(ii, eval, envir = globalenv())
ee$call  # the 'seas' object produced from the .spc file

Run the code above in your browser using DataLab