Skip to content
Prev 327063 / 398502 Next

'save' method for S4 class

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 at 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,