get_view_handler() is called by view() to determine how to display an object.

default_view_handler() is the view handler returned by default. It calls utils::View(); the RStudio IDE overrides this function, this is picked up correctly.

suppress_view() basically turns off view(), permit_view() reenables it.

register_view_handler_factory() and unregister_view_handler_factory() allow users and packages to override the default view handler. See the section "View handler factories" for details.

get_view_handler(x)

default_view_handler(x, title)

suppress_view()

permit_view()

register_view_handler_factory(factory)

unregister_view_handler_factory(factory)

Arguments

x

The object to display.

factory

A function with exactly one argument, x.

Value

A function with at least two arguments, x and title.

View handler factories

When a factory is registered with register_view_handler_factory(), each time view() is called, that factory will be consulted. The function in the factory argument will be called with the object to display; if it returns a handler, i.e. a function with a signature similar to default_view_handler, the handler will be called with the object. If the factory returns NULL the next factory will be consulted. If no factory returns a handler, the default view handler is called.

Factories are consulted in the reverse order of registration, the factory registered last will be called first. Re-registering a factory moves it to the top of the chain. Unregistering a factory makes sure it won't be called again.