Have a look at the {rio} package. On Tue, 28 Feb 2023 at 15:00, Leonard Mada via R-help <r-help@r-project.org> wrote:
> Dear R-Users, > > I noticed that *read* is not a generic function. Although it could > benefit from the functionality available for generic functions: > > read = function(file, ...) UseMethod("read") > > methods(read) > # [1] read.csv read.csv2 read.dcf read.delim read.delim2 > read.DIF read.fortran > # [8] read.ftable read.fwf read.socket read.table > > The users would still need to call the full function name. But it seems > useful to be able to find rapidly what formats can be read; including > with other packages (e.g. for Excel, SAS, ... - although most packages > do not adhere to the generic naming convention, but maybe they will > change in the future). > > Note: > This should be possible (even though impractical), but actually does NOT > work: > read = function(file, ...) UseMethod("read") > file = "file.csv" > class(file) = c("csv", class(file)); > read(file) > > Should it not work? > > Sincerely, > > Leonard > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > -- John Kane Kingston ON Canada [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.