Extensible functions in R