addHvrule {tablesgg} | R Documentation |
Add a Horizontal or Vertical Rule (Hvrule) to a Table
Description
Add a horizontal or vertical rule (hvrule) to a table. The location, span, and graphical properties of the hvrule are specified explicitly, rather than being generated automatically from the logical structure of the table and a style.
Usage
addHvrule(x, direction, arows, acols, id, props=NULL, enabled=TRUE)
Arguments
x |
A plotted table ( |
direction |
Character string specifying whether the rule is to be horizontal
( |
arows , acols |
Numeric vectors specifying the location and span of the hvrule, with
respect to the augmented row-column grid of the table. For an hrule,
|
id |
Character string giving the ID to be assigned to the new hvrule. It is an
error if there is already an hvrule with this ID in |
props |
Optional |
enabled |
Logical scalar, whether the new hvrule is to be enabled for display. The default is TRUE. |
Details
Normally hvrules are generated automatically, based on the logical structure of the table and the style selected by the user. This function allows additional hvrules to be added "manually", explicitly specifying their position and span in terms of row and column numbers.
Row and column numbers are with respect to the augmented row-column grid
of the table. See ?adim
for more more information about this grid.
The helper functions arow
and acol
can be used to specify
arguments arows
and acols
in terms of table parts or
previously defined blocks.
For an hrule
, the default for acols
is to span all table
columns. For a vrule
, the default for arows
is to span the
rows containing the body and column headers, but not the annotation.
Graphical properties for hvrules defined by this function will not be
changed if a new hvrule style is applied to the plotted table. Use one of
the props<-
functions instead.
There is no way to remove an hvrule, other than recreating the plotted
table object from scratch. However they can be disabled using a
props<-
function, and then will not be displayed or take up any
space.
Value
A plotted table object like x
, with the new hvrule added.
See Also
arow
, acol
, adim
,
element_hvrule
Examples
plt <- plot(iris2_tab, title="The iris data")
plt <- addHvrule(plt, direction="vrule", acols=4.5, arows=arow(plt, "body"),
id="new_vrule",
props=element_hvrule(linetype=2, color="red"), enabled=TRUE)
plt
# Can refer to the new hvrule by its ID:
props(plt, id="new_vrule") <- element_hvrule(enabled=FALSE) # don't display it
plt