[R] S4 methods: unable to find an inherited method

H. Paul Benton hpbenton at scripps.edu
Wed Aug 8 00:06:36 CEST 2007


Hello all,

    I consider myself pretty new to the whole OO based programming so
I'm sorry if I'm doing something stupid.

> xml<-read.metlin(url)
Error in function (classes, fdef, mtable)  :
        unable to find an inherited method for function "read.metlin",
for signature "url"

>read.metlin
standardGeneric for "read.metlin" defined from package ".GlobalEnv"

function (xml, ...)
standardGeneric("read.metlin")
<environment: 0x83a8ae4>
Methods may be defined for arguments: xml

> url
                                       description
"http://metlin.scripps.edu/download/MSMS_test.XML"
                                             class
                                             "url"
                                              mode
                                               "r"
                                              text
                                            "text"
                                            opened
                                          "closed"
                                          can read
                                             "yes"
                                         can write
                                              "no"

I defined my methods as :


if (!isGeneric("read.metlin") )
    setGeneric("read.metlin", function(xml) standardGeneric("read.metlin"))

setMethod("read.metlin", "xcmsRaw", function(xml) {
#Parsing the METLIN XML File
    reading<-readLines(xml)
#    do rest of script

})

Any help as to why I'm getting the inherited method error would be great.

Cheers,

Paul



More information about the R-help mailing list