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.

Reply via email to