python - Python中的R。错误:$ 运算符对原子向量无效
问题描述
我刚开始尝试在 Python 中使用 R,因为有一些有趣的包。我正在使用包 rpy2 在 python 环境中使用 R。有人可以帮我理解为什么我有这个错误吗?我不在我的代码中使用 $ 。错误发生在 fitMCMC。
from rpy2.robjects.packages import importr
import rpy2.robjects as ro
ms = importr('MSGARCH')
from rpy2.robjects import r, pandas2ri, numpy2ri, vectors
pandas2ri.activate()
numpy2ri.activate()
base = importr('base')
stats = importr('stats')
spec = ms.CreateSpec(variance_spec = ro.ListVector( ro.StrVector(['sGARCH', 'sGARCH'])),
distribution_spec = ro.ListVector( ro.StrVector(['norm', 'norm']))
)
X = my_data
fitMCMC = ms.FitMCMC(spec = spec, data = X, ctr = ro.ListVector({'nburn' : '500L', 'nmcmc' : '500L', 'nthin' : '1L'}))
print(base.summary(fitMCMC))
解决方案
推荐阅读
- spring - Spring 配置 Principal.getname() 以返回 JWT 电子邮件声明
- amazon-web-services - AWS API Gateway 未调用指定的 lambda
- r - 如何总结列中的值,条件是不同列的值是否在 R 中匹配?
- android - 如何在 Xamarin.Forms Android / iOS 中关注其他(特定)视图后保持键盘打开?
- javascript - 有没有办法在我的网站上存储登录输入?
- firebase - 将 json 文件中的 Firebase 存储服务凭证添加到 Spring Boot 应用程序的 Heroku 配置变量
- css - Cargo Collective - Photowiper /“缩放”功能
- sql - 如何判断 Postgres 触发器是否/何时执行
- r - 使用 dbWriteTable 时可以为 field.types 设置默认值吗?
- python - 在 pythonanywhere 上运行 Telethon