How to create an array of your objects in R?
Suppose I have a class:
setClass("Runner", representation(name="character",time="numeric",place="numeric"), prototype(time=0,place=0) ) a = readline("Enter amount of person") foo = list() for(i in 1:a){ u = readline("Name") t = readline("Time") t = as.integer(t) tmp = new ("Runner", name = u, time = t ) foo[i]=tmp } foo is my array of objects. But when compiling the error:
In `[<-` (` * tmp * `, i, value =): implicit list embedding of S4 objects is deprecated