forester
forester copied to clipboard
The save() function and the principle of least surprise.
Instead of overriding the base::save() function, could you just give yours a new name like forester_save() or something like that?
Otherwise you break the user's ability to save R objects unrelated to forester.
If for some reason you must override save(), can you please alter your function to use a compatible syntax with base::save() by doing the following:
- Have the third argument be named
fileinstead ofname. - Get rid of the fourth argument,
pathbecausenamecan be a bare file name, a full path, or a relative path and that's how all other save functions in R handle it. - Include
...at the end of the signature so you can collect anysave()arguments thatforester::save()doesn't use and pass them tobase::save(). Or at least ignore them instead of erroring which is what currently happens if the user uses an argument supported bybase::save()but notforester::save().
This is very easy to do, and I'll be happy to submit a PR if that's something you would approve. Please let me know.
Hi, thank you for a valuable comment, we will definitely address that in the near future.