Hi all. I am having problems with inheritance in reference class, here is a small example:
Myclass = setRefClass("Myclass", fields = list( fa = "numeric", fb = "numeric", filename = "character", data = "data.frame" )) Myclass$methods( initialize = function(fa = 0, fb = 0, filename = "") { message("Initializing object in class...") .self$fa = fa .self$fb = fb .self$data = read.table(.self$filename, header=TRUE) }) # Myclass1 = setRefClass("Myclass1",# fields = list(# fc = "numeric"# ),# contains = "Myclass"# )# # Myclass1$methods(# initialize = function(..., fc = 0) {# message("Initializing object in class1...")# callSuper(...)# .self$fc = fc# }# )# # Myclass2 = setRefClass("Myclass3",# fields = list(# fd = "numeric"# ),# contains = "Myclass1"# )# # Myclass2$methods(# initialize = function(..., fe = 0) {# message("Initializing object in class2...")# callSuper(...)# .self$fe = fe# }# ) This loads ok. But if you uncomment the subclasses R will complain when loading: ==> R CMD INSTALL --no-multiarch --with-keep.source testLoadRef * installing to library ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library’* installing *source* package ‘testLoadRef’ ...** R** preparing package for lazy loading Initializing object in class... Error in file(file, "rt") : invalid 'description' argument Error : unable to load R code in package ‘testLoadRef’ ERROR: lazy loading failed for package ‘testLoadRef’* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/testLoadRef’* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/testLoadRef’ Exited with status 1. Best regards, Kaiyin ZHONG ________________________________ FMB, Erasmus MC http://kaiyin.co.vu k.zh...@erasmusmc.nl kindlych...@gmail.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.