ReporteRs (version 0.5.6)

[<-.FlexTable: modify FlexTable content

Description

add text into a FlexTable object or Format content of a FlexTable object

Usage

# S3 method for FlexTable
[ (x, i, j, text.properties, newpar = F, byrow = FALSE) <- value

Arguments

x

the FlexTable object

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. or an object of class textProperties.

text.properties

formatting properties (an object of class textProperties).

newpar

logical value specifying wether or not the content should be added as a new paragraph

byrow

logical. If FALSE (the default) content is added by columns , otherwise content is added by rows.

value

To modify content formatting properties, value should be an object of class cellProperties or an object of class parProperties or an object of class textProperties. To add content, value should be a data.frame or a matrix or a vector with as many elements as defined by the selection. An exception is possible, if value is a vector of length 1, its value will be repeated in all cells defined by the selection.

See Also

addHeaderRow, addFooterRow , FlexTable, setFlexTableBorders , spanFlexTableRows, spanFlexTableColumns , setRowsColors, setColumnsColors, setZebraStyle , addFlexTable, addFlexTable.docx , addFlexTable.pptx, addFlexTable.html

Examples

Run this code
# NOT RUN {
#START_TAG_TEST
# Create a FlexTable object with first 10 lines of data.frame mtcars
# add row.names as first column
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"
#STOP_TAG_TEST
# }

Run the code above in your browser using DataCamp Workspace