I am struggling with extracting members from lists. The code shown below produces a list of 5 members with each member having a (sub)list of two members. I would like to extract the first members of each sub-list i.e (W1 and V1). How do I do this?
library(wavelets)
library(fGarch)
x<-rnorm(32)
spec.c <- garchSpec(model = list(omega=0.99, alpha=0.005, beta=0.005))
sim <- replicate(5, dwt(cumsum(garchSim(spec.c, n = 32)), filter="haar",
n.levels=2, boundary="reflection"))
Many thanks.
Try this...
You'll get a list of the first
W
of each of the 5 top-level lists and the firstV
of each of the 5 top-level lists.The
@
operator is used to access named slots in anS4
type object.