[英]Descriptive Statistics of “timeSeries” structure data using psych package in R
Sorry for this stupid question, I am new to R. I have some in such formate and saved in CSV: 对不起这个愚蠢的问题,我是R的新手。我有一些这样的格式,并保存为CSV:
%Y-%m-%d,st1,st2,st3,st4,st5,st6,st7,st8,st9,st10
2005-09-20,38.75,48.625,48.5,23.667,45.5,48.75,18.75,33.25,43.455,76.042
2005-09-21,39.482,49.3,49,23.9,46.15,50.281,18.975,34.125,44.465,78.232
...
I import it in R 我将其导入R
library(fPortfolio)
Data <- readSeries(file = "data.csv", header = TRUE, sep = ",")
I want to have some descriptive statistics 我想要一些描述性的统计数据
library(psych)
describe(Data)
Error in x[!is.na(x[, i]), i] :
invalid or not-yet-implemented 'timeSeries' subsetting
Any suggestion? 有什么建议吗?
you probably want to make it a time series first right? 您可能想先将其设为时间序列?
tS <- dummySeries() #make quick dummy time series
describe(tS) # fails
but 但
newtS<-as.ts(tS)
describe(newtS) #works fine giving:
var n mean sd median trimmed mad min max range skew kurtosis se
Series 1 1 12 0.49 0.25 0.44 0.48 0.29 0.13 0.89 0.76 0.24 -1.52 0.07
Series 2 2 12 0.45 0.28 0.44 0.45 0.42 0.07 0.83 0.77 0.03 -1.74 0.08
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.