Background is that I'm working on a package which creates an un-writable dataframe-like object which let's call fancy_df
. The way I'm accomplishing this is writing methods for write.csv
and other output common output functions which will ask the user to confirm that they really want to save the file.
My issue is that I want to have the object inherit from the data.frame
class and so have access to all of those methods, but have all those methods return fancy_df
s, but I don't want to write all those methods myself. In my mind I'm thinking of a catch all method that would be do the following for all data.frame methods:
f.fancy_df <- function(...) { as_fancy_df(f(...))}
Does anyone know how to do this? Or alternatively if there's a name for what I'm trying to do?
This is all for an internal package which will never see CRAN.