I'd like to add an alias to an R6 class in the form of a regular function (e.g. new_foo()
) to make the creation of an object a little bit easier for users.
#' @title Foo class
#' @description Blah blah
#' @export
Foo <- R6::R6Class(
public = list(
#' @description Create a Foo object
#' @param a First parameter.
#' @param b Second parameter.
#' @param c Thrid parameter.
#' @return NULL
initialize = function(a, b, c) {}
)
)
#' @rdname Foo
#' @export
new_foo <- Foo$new
I was wondering if there's a way to show the different parameters when calling the alias as it's the case with a regular function. I'd prefer not to add all the parameters to the alias manually with a wrapper function (new_foo <- function(a, b, c) Foo$new(a, b, c)
).
With the code above, the parameters are replaced with ...
in the info box when writing the function.
Using tab for the autocompletion will properly list the different parameters though.