DRAIDDOWNS - 성능 분석 오류 - 요소 및 숫자
-
20-12-2019 - |
문제
텍스트 파일의 일부 데이터 :
date,p
2013-11-14,0.001
2013-11-13,-0.005
2013-11-12,0.001
library(PerformanceAnalytics)
stuff<-read.csv("C:stuffexample.txt")
str(stuff)
'data.frame': 3 obs. of 2 variables:
$ date: Factor w/ 3 levels "2013-11-12","2013-11-13",..: 3 2 1
$ p : num 0.001 -0.005 0.001
.
데이터에 대한 성능 분석을 사용하고 싶습니다.
AverageDrawdown(stuff)
Error in checkData(R) :
The data cannot be converted into a time series. If you are trying to pass in names from a data object with one column, you should use the form 'data[rows, columns, drop = FALSE]'. Rownames should have standard date formats, such as '1985-03-15'.
table.Drawdowns(box)
Error in checkData(R[, 1, drop = FALSE]) :
The data cannot be converted into a time series. If you are trying to pass in names from a data object with one column, you should use the form 'data[rows, columns, drop = FALSE]'. Rownames should have standard date formats, such as '1985-03-15'.
.
오류를 수정하려면 어떻게합니까?
해결책
오류에 주어진 조언을 따라야합니다.날짜의 행 이름과 데이터 만 데이터 만 가져와야합니다 .Frame :
row.names(stuff) <- levels(stuff$date)[stuff$date]
stuff2 <- stuff[, 'p', drop=FALSE]
AverageDrawdown(stuff2)
.
이것은 당신이 재현 가능한 예제를 제공하지 않았기 때문에 테스트되지 않았습니다 ...
제휴하지 않습니다 StackOverflow