RStudio错误:意外的符号(无法找到)

时间:2014-09-09 04:02:51

标签: r rstudio

希望有一个眼睛更敏锐的人可以帮助我。当我运行下面的两个代码块时,第一个块就可以了:

add.rule(strategy.st, name = "ruleSignal",
         arguments = list(sigcol = "exitLongNormal",
                          sigval = TRUE,
                          orderqty = "all",
                          ordertype = "market",
                          orderside = "long",
                          replace = FALSE,
                          prefer = "Open",
         type = "exit", path.dep = TRUE, label = "normalExitLong")

add.rule(strategy.st, name = "ruleSignal",
         arguments = list(sigcol = "exitLongFilter",
                          sigval = TRUE,
                          orderqty = "all",
                          ordertype = "market",
                          orderside = "long",
                          replace = FALSE,
                          prefer = "Open",
        type = "exit", path.dep = TRUE, label = "filterExitLong")

当跑步时,初始块给我这个:

> add.rule(strategy.st, name = "ruleSignal",
+          arguments = list(sigcol = "exitLongNormal",
+                           sigval = TRUE,
+                           orderqty = "all",
+                           ordertype = "market",
+                           orderside = "long",
+                           replace = FALSE,
+                           prefer = "Open",
+          type = "exit", path.dep = TRUE, label = "normalExitLong")
然而,

Block 2是问题孩子,跑步时我得到以下内容:

Error: unexpected symbol in:
"         type = "exit", path.dep = TRUE, label = "normalExitLong")
add.rule"

这似乎很容易找到,但对于我的生活,我无法弄明白。提前感谢任何意见。

1 个答案:

答案 0 :(得分:3)

这是不匹配的parens:

add.rule(strategy.st, name = "ruleSignal",                          # OPEN
         arguments = list(sigcol = "exitLongNormal",                # OPEN
                          sigval = TRUE,
                          orderqty = "all",
                          ordertype = "market",
                          orderside = "long",
                          replace = FALSE,
                          prefer = "Open",
         type = "exit", path.dep = TRUE, label = "normalExitLong")  # CLOSE