repr() creates a call object representing obj, if possible. Evaluating the call should come close to recreating the original object.

In the most trivial cases, it should be possible to recreate objects from their representation by evaluating them using eval(). Important exceptions are:

  • Functions are represented by their source code, if available, and by their AST if not. This drops the context from their environments and recreated objects will not work if they contain functions that depend on specific environments

  • environments are not represented.

  • R6 objects are only represented if they have a $repr() function. This function may have arbitrary arguments, and should have a ... argument to capture ignored arguments.

Objects that can not be represented are currently mapped to the call stop("<###>"), where ### is a short description of the non-representable object.

repr(obj, ...)

Arguments

obj

(any)
Object to create a representation of.

...

(any)
Further arguments to be passed to class methods. Currently in use are:

  • skip_defaults (logical(1)) whether to skip construction arguments that have their default value. Default TRUE.

  • show_params (logical(1)) whether to show ParamSet values. Default TRUE.

  • show_constructor_args (logical(1)) whether to show construction args that are not ParamSet values. Default TRUE.

Value

call: A call that, when evaluated, tries to re-create the object.