Learn R Programming

psd (version 1.0-1)

spec-methods: Generic methods for objects with class 'spec'

Description

Generic methods for objects with class 'spec'

Usage

# S3 method for spec
as.list(x, ...)

as.spec(x, ...)

# S3 method for amt as.spec(x, ...)

# S3 method for spec lines(x, y = NULL, type = "l", ...)

# S3 method for spec as.data.frame(x, ...)

data.frame.spec(x, ...)

Arguments

x

a 'spec' object

...

optional arguments

y

optional coordinate vector for the y-axis

type

character; the type of plot

Details

Objects with class 'spec' are simply lists with spectral estimates and parameters as.data.frame converts the list into a 'data.frame' with individual columns for the frequency, PSD, and taper vectors; all other information will be retained as an attribute.

Examples

Run this code
# NOT RUN {
#REX
library(psd)

##
## Objects with class 'spec'
##

set.seed(1234)
xn <- rnorm(10)
x <- spectrum(xn, plot=FALSE)
xc <- psdcore(xn)

xdf <- as.data.frame(x)
str(xdf)
is.tapers(xdf$taper)

xdfc <- as.data.frame(xc)
str(xdfc)
is.tapers(xdfc$taper)

# }
# NOT RUN {
#REX
# }

Run the code above in your browser using DataLab