下面是一个动物园对象的摘录,我试图winsor
从psych
包中使用它进行winsorize:
x <- structure(c(0.0400337546529555, -0.0320371743076633, 0.0106006766976862,
-0.011406282992093, -0.018676165248018, 0.0275956214868875, 0.00473575019758404,
0.0986083620222542, 0.00615420656427005, 0.00709069372334476), .Names = c("1984-01",
"1984-02", "1984-03", "1984-04", "1984-05", "1984-06", "1984-07",
"1984-08", "1984-09", "1984-10"), index = structure(c(5113, 5144,
5173, 5204, 5234, 5265, 5295, 5326, 5357, 5387), class = "Date"), class = c("zooreg",
"zoo"), frequency = 1)
我用:
winsor(x, trim=0.1)
我得到以下信息:
function ()
.Last.value
<environment: namespace:gdata>
我尝试了具有相同类(即zoo
和zooreg
)的以下数据的函数:
a <- structure(c(1, 2, 3), .Dim = c(3L, 1L), .Dimnames = list(NULL,
"a"), index = structure(c(5113, 5144, 5173), class = "Date"), frequency = 1, class = c("zooreg",
"zoo"))
它可以正常工作,a
但不确定为什么它会针对特定类型的数据返回上述内容x
。