Description Usage Arguments Value Author(s) References See Also Examples
This function acts as a constructor for an
RDevDescMethods-class
object which collects functions together that collectively implement
an R graphics device. The resulting S4 object can then be passed
to graphicsDevice
to create an active graphics device on
which we can draw R graphics.
This function takes the functions specified
either individually as name = function
(via ...) or as an existing list
of named elements (via funcs
). It then assigns these functions to the corresponding
slots in the RDevDescMethods-class
object.
One can use the ... and the funcs
parameters together and
those functions specified in ... will be merged with those in funcs
.
By default, the function creates and populates
its own instance of the RDevDescMethods-class
object that
is returned. However, one can pass an already created object
of class RDevDescMethods-class
or a sub-class.
This allows this function to be used for initializing sub-classes.
The function is sufficiently general that it uses run-time slot access
so it naturally handles sub-classes and indeed objects entirely
different classes.
1 2 3 |
... |
a collection of |
funcs |
a named list of functions. This is an alternative to the ...
specification that is convenient when the functions have already
been collected into a list and it is akward to specify them via the
... parameter, e.g. via |
obj |
the object whose slots are to be populated by the functions
specified via ... and |
ensureMetric |
a logical value that controls whether we force
the insertion of a default strWidth and metricInfo
method that compute sensible values, if these are not specified by
the user, i.e. if the default implementations are there from
|
obj
with some of its slots updated.
Duncan Temple Lang
“The R Internals Manual”, R Development Core Team.
RDevDescMethods-class
graphicsDevice
1 2 | o = makeGraphicsDeviceObject()
o@strWidth = function(str, gcontext, dev) { nchar(str) * 12}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.