楼主: 玛丽羊lu
2368 2

[问答] 系统报错 Error in checkData(R, method = "xts") [推广有奖]

  • 0关注
  • 0粉丝

学前班

70%

还不是VIP/贵宾

-

威望
0
论坛币
5 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
80 点
帖子
1
精华
0
在线时间
3 小时
注册时间
2018-6-20
最后登录
2019-12-7

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
HS300 <- read_csv("HS300.csv", col_names = TRUE)
head(HS300)
HS300 <- as.vector(HS300)
#Create a vector of equal weights
equal_weights <- rep(1 / ncol(HS300_2), ncol(HS300_2))
#Compute the benchmark returns
benchmark_returns <- HS300 %>%
  Return.portfolio(weights = equal_weights,
                   rebalance_on = "quarters")

不知道为什么报错:
Error in checkData(R, method = "xts") :
  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'.
In addition: Warning message:
In if (class(x) == "numeric") { :
  the condition has length > 1 and only the first element will be used

请高手们解答一下该如何改正,谢谢!


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Method Error check Data Chec R语言

HS300.xlsx

12.42 KB

数据

沙发
hifinecon 发表于 2018-6-21 23:13:00 |只看作者 |坛友微信交流群
you need to convert date into time series format first, otherwise, they are strings to R.
已有 1 人评分论坛币 收起 理由
cheetahfly + 10 热心帮助其他会员

总评分: 论坛币 + 10   查看全部评分

使用道具

藤椅
cheetahfly 在职认证  发表于 2018-6-22 08:12:09 |只看作者 |坛友微信交流群
为了提高别人解决你所提问题的兴趣与效率,请附带能够重复错误的数据。

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-27 09:16