- > setClass("Testit",representation(ID="numeric",name="character",book="Fangjibook"))
- > A1<-new("Testit",ID=1)
- > A2<-new("Testit",ID=2)
- > A3<-new("Testit",ID=3)
- > class(A1)
- [1] "Testit"
- attr(,"package")
- [1] ".GlobalEnv"
- > Agroup<-c(A1,A2,A3)
- > class(Agroup)
- [1] "list"
- > class(Agroup[1])
- [1] "list"
- > isS4(A1)
- [1] TRUE
- > isS4(Agroup[1])
- [1] FALSE
可见,用list组合众多实例不可行。
问题二,如何获得环境内一个S4对象的所有实例的列表?
其实这个问题也涉及到第一个问题,即实例的结合问题。
请大神指点!


雷达卡




京公网安备 11010802022788号







