On Tue, 17 Jul 2007, Nils Rüfenacht wrote:

Dear all!

I do definetley have some difficulties. Here is my code:

setMethod("write",
+             signature(object = "KMatrix", path = "character"),
+             function(object,path){
+             write.table([EMAIL PROTECTED],path,row.names=FALSE, sep = "\t")
+             }
+             )
error in match.call(fun, fcall) : unused argument(s) (object =
"KMatrix", path = "character")


"KMatrix" is an extension of some data.frame object, i.e. it's a
data.frame ([EMAIL PROTECTED]) with some additional slots (e.g. [EMAIL 
PROTECTED])

What's wrong with my setMethod?

Take a look at the existing function 'write':
write
function (x, file = "data", ncolumns = if (is.character(x)) 1 else 5,
    append = FALSE, sep = " ")
cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1), "\n"),
    append = append)

You are trying to set a method for it with completely different arguments.

I am not sure what you are trying to achieve by this: it would look more natural to set a write.table() method since no one is going to call write() on the data frames you are wishing to 'extend'.

--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
______________________________________________
[email protected] 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