I am working with R and I have created a new subset
method for objects of class new_object
. Here is my function:
setGeneric('subset', function(x, i) standardGeneric('subset'))
setMethod('subset', 'new_object', function(x, i) {
# ... my code ...
# subset new_object
})
This works perfectly for new_object
. However, it seems to interfere with the subset operation of other objects, like seurat
objects. I get an error when I try to subset a seurat object after loading my new subset method.
The inheritance method for the 'subset' function with the 'Seurat' tag could not be found.
I would like the subset method to work as usual for all other types of objects, except for new_object
, for which I want to use my new subset method.
How can I define a new subset method for a specific class without affecting other objects in R?