flextable (version 0.5.6)

rotate: rotate cell text

Description

apply a rotation to cell text

Usage

rotate(x, i = NULL, j = NULL, rotation, align = "center",
  part = "body")

Arguments

x

a flextable object

i

rows selection

j

columns selection

rotation

one of "lrtb", "tbrl", "btlr"

align

vertical alignment of paragraph within cell, one of "center" or "top" or "bottom".

part

partname of the table (one of 'all', 'body', 'header', 'footer')

Details

One common case is to rotate text to minimise column space. When rotating, paragraph alignments will remain the same and often right aligned ( with an effect of top aligned when rotated). Use align(..., align = "center") to center rotated text.

When function autofit is used, the rotation will be ignored.

See Also

Other sugar functions for table style: align, bg, bold, color, empty_blanks, fontsize, font, italic, padding, valign

Examples

Run this code
# NOT RUN {
ft <- flextable(head(iris))
ft <- rotate(ft, rotation = "tbrl", part = "header", align = "center")
ft <- align(ft, align = "center")
ft <- autofit(ft)
ft <- height(ft, height = max(dim_pretty(ft, part = "header")$widths), part = "header")
# }

Run the code above in your browser using DataCamp Workspace