我收到错误信息,例如"二元运算符的非数字参数"当我输入以下代码时。非常感谢你的评论!
library(zoo)
library(PerformanceAnalytics)
library(quantmod)
price_m = read.csv("F:/R_Doc/price_m.csv", row.names=1, header=TRUE)
price_m[is.na(price_m)] = 0
price_kospi = read.csv("F:/R_Doc/kospi.csv", row.names=1, header=TRUE)
ro = dim(price_m)[1]
co = dim(price_m)[2]
ret_kospi = Delt(price_kospi)
在unclass(x2)/ Lag(x1,K。)中出错: 二元运算符的非数字参数
我的数据存储在kospi.csv
文件中,其值如下:
Date KOSPI200
12/31/1994 113.51
1/31/1995 102.85
2/28/1995 98.9
3/31/1995 104.86
4/30/1995 101.78
5/31/1995 99.96
6/30/1995 101.3
7/31/1995 105.69
8/31/1995 103.45
9/30/1995 111.97
10/31/1995 113.08
11/30/1995 104.82