Message-ID: <1241895019.19090.64.camel@kropotkin>
Date: 2009-05-09T18:50:19Z
From: Carlos J. Gil Bellosta
Subject: "Overloading" some non-dispatched S3 methods for new classes
Hello,
I am building a package that creates a new kind of object not unlike a
dataframe. However, it is not an extension of a dataframe, as the data
themselves reside elsewhere. It only contains "metadata".
I would like to be able to retrieve data from my objects such as the
number of rows, the number of columns, the colnames, etc.
I --quite naively-- thought that ncol, nrow, colnames, etc. would be
dispatched, so I would only need to create a, say, ncol.myclassname
function so as to be able to invoke "ncol" directly and transparently.
However, it is not the case. The only alternative I can think about is
to create decorated versions of ncol, nrow, etc. to avoid naming
conflicts. But I would still prefer my package users to be able to use
the undecorated function names.
Do I have a chance?
Best regards,
Carlos J. Gil Bellosta
http://www.datanalytics.com