无法解析 R 中的数据 [英] Unable to parse data in R

查看:22
本文介绍了无法解析 R 中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要进行时间序列分析,但我无法找出原因

Hi I"m going a Time series analysis, and I cannot figure out the cause of

Error in parse(text = x, srcfile = src): <text>:10:10: unexpected input

我试图重写我的代码(如下所示),但我一直收到同样的错误

I have tried to rewrite my code(shown below), but I keep on getting the same error

set.seed(1000)
N <- 100
t <- 1:N
x1 <- 2 * t + rnorm(N, 0.2, 4)
m1 <- lm(x1 ~ t)
summary(m1)
y1 <- x1 — m1$coefficients[2] * t

上面的代码给了我上面引用的错误.任何帮助将不胜感激.

The code above gives me the error I have quoted above. Any help would be appreciated.

推荐答案

只是想用解决方案更新它.我需要括号才能工作.

Just wanted to update it with the solution. I needed parentheses for it to work.

y1 <- x1 — (m1$coefficients[2] * t)

这篇关于无法解析 R 中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆