Hi Christopher, I think, that "save" is no generic function like "plot", "show", etc. So at first you have to determine a generic.
setGeneric("save", function(x, file_Path) standardGeneric("save")) Now your definition via setMethod. Best Simon On Jul 18, 2013, at 12:09 PM, Christofer Bogaso <bogaso.christo...@gmail.com> wrote: > Hello again, > > I am trying to define the 'save' method for my S4 class as below: > > setClass("MyClass", representation( > Slot1 = "data.frame" > )) > > setMethod("save", "MyClass", definition = function(x, file_Path) { > > write.table(x@Slot1, file = file_Path, append = FALSE, quote = > TRUE, > sep = ",", > eol = "\n", na = "NA", dec = > ".", row.names = FALSE, > col.names = TRUE, qmethod = > c("escape", "double"), > fileEncoding = "") > }) > > However while doing this I am getting following error: > > Error in conformMethod(signature, mnames, fnames, f, fdef, definition) : > in method for ‘save’ with signature ‘list="MyClass"’: formal > arguments (list = "MyClass", file = "MyClass", ascii = "MyClass", > version = "MyClass", envir = "MyClass", compress = "MyClass", > compression_level = "MyClass", eval.promises = "MyClass", precheck = > "MyClass") omitted in the method definition cannot be in the signature > > > Can somebody point me what will be the correct approach to define > 'save' method for S4 class? > > Thanks and regards, > > ______________________________________________ > 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. ______________________________________________ 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.