I'm trying to create a class in R called move, and want one of the fields to be type move as well. I know this is possible in Java, but I'm unsure how to do this in R (if it can be done).
I've tried searching for examples, but have been unable to find any. This is what my code looks like:
move = setRefClass("move", fields=list(pos="numeric", backtracker="move"))
This is the error I get when trying to run the above line:
Error in refClassInformation(Class, contains, fields, methods, where) : class “move” for field ‘backtracker’ is not defined
Is it possible to do something like this in R?
Thanks in advance!
One way to do it would be to use ANY to avoid the "chicken and egg" problem e.g.