add text or format a FlexTable object.
# S3 method for FlexTable [ (x, i, j, text.properties, newpar = FALSE, byrow = FALSE, to = "body", side = "top") <- value
x | the |
---|---|
i | vector (integer index, row.names values or boolean vector) for rows selection. |
j | vector (integer index, col.names values or boolean vector) for columns selection. |
text.properties | formatting properties (an object of class |
newpar | logical value specifying wether or not the content should be added as a new paragraph (therefore added on a new line). |
byrow | logical. If |
to | specify on which part of the FlexTable to apply the |
side | used only when value is a |
value | see details. |
Use ft_object[1:4, 2:3] <- value
to perform the operation
on the body subset of of the FlexTable.
Use ft_object[] <- value
to perform the operation
on the whole part (body, header or footer) of the FlexTable.
Use ft_object[1, 2, to = "header"] <- value
to perform the operation
on the header subset of the FlexTable.
Use ft_object[1, 2, , to = "footer"] <- value
to perform the operation
on the footer subset of the FlexTable.
To format content, argument value
(the right side of the <-
) should
be one of the following:
for table cells: an object of class cellProperties
for paragraphs contained in table cells: an object of class parProperties
for text contained in table cells: an object of class textProperties
for borders of table cells: an object of class borderProperties
To add content, there are two options:
option 1: value should be a data.frame
or a matrix
or a vector
with as many elements
as defined by the selection.
option 2: value is a pot
object,
its value will be added in all cells defined by the selection.
If dealing with borderProperties
objects, use also argument
side
to specify on which side of cells to apply border
properties.
FlexTable
, borderProperties
, cellProperties
, parProperties
, textProperties
MyFTable <- FlexTable( data = mtcars[1:10, ], add.rownames=TRUE ) # modify the text formatting properties for the row.names column MyFTable[ , 1] <- textProperties( font.style="italic", font.size = 9) # align text to right for the row.names column MyFTable[ , 1] <- parProperties( text.align = "right" ) # change cell formatting properties for various columns MyFTable[ c(3,6:9), c( "mpg", "disp", "hp", "drat", "wt", "qsec" ) ] <- cellProperties( background.color="#CCCCCC") # add text to elements of the column cyl MyFTable[, "cyl", text.properties = textProperties( vertical.align="superscript", font.size = 9) ] <- " miles/gallon"