问题描述
我正在使用程序中的小波,并且使用包wavelets
使用函数dwt
创建时间序列的DWT.此函数返回类dwt
的对象,该对象是具有许多插槽的S4对象:W
,V
,levels
,filter
等.
I'm working with wavelets on a program and I'm used the package wavelets
to create the DWT of a time series using the function dwt
. This function returns an object of class dwt
, which is a S4 object with many slots: W
, V
, levels
, filter
, and so on.
如何将W
作为矢量访问?
推荐答案
@
将允许您访问S4对象的插槽.
@
will let you access the slots of an S4 object.
因此,如果您的对象称为wave
,则wave@W
应该可以为您提供矢量.
So if your object is called wave
, then wave@W
should get you your vector.
请注意,通常最好的方法是不直接访问插槽,而是通过访问器功能(例如coefs()
而不是用$
或@
挖出系数).但是,通常不存在此类功能,因此您必须直接访问插槽.这意味着如果内部实施发生了变化.
Note that often the best way to do this is to not access the slot directly but rather through an accessor function (e.g. coefs()
rather than digging out the coefficients with $
or @
). However, often such functions do not exist so you have to access the slots directly. This will mean that your code breaks if the internal implementation changes, however.
这篇关于如何在R中访问S4对象的插槽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!