gramEvol package Error in 1:possible.choices : argument of length 0

21 Views Asked by At

I am trying to write a grammar but i get an error

Error in 1:possible.choices : argument of length 0

here is my grammar

library(gramEvol)
rules <- list(
              For = gsrule("for(i in 5:200) {  X[i,] <- <ex>  }"),
              
              ex  = gsrule("<x><op><x>"),
              x   = gsrule("p[i-<i>]","p[i]"),
              i   = gvrule(1:5),
              op  = gsrule("+","-","/","*")
              )
grammar <- CreateGrammar(rules)
gramEvol::GrammarRandomExpression(grammar)

the problem is in this line

For = gsrule("for(i in 5:200) {  X[i,] <- <ex>  }") 

without this <- <ex> part everything works

0

There are 0 best solutions below