Skip to contents

It displays the first rows and shows the column types. If there is only one row, a simplified vertical table is produced.

Usage

# S3 method for data.frame
as_flextable(
  x,
  max_row = 10,
  split_colnames = FALSE,
  short_strings = FALSE,
  short_size = 35,
  short_suffix = "...",
  do_autofit = TRUE,
  show_coltype = TRUE,
  color_coltype = "#999999",
  ...
)

Arguments

x

a data.frame

max_row

The number of rows to print. Default to 10.

split_colnames

Should the column names be split (with non alpha-numeric characters). Default to FALSE.

short_strings

Should the character column be shorten. Default to FALSE.

short_size

Maximum length of character column if short_strings is TRUE. Default to 35.

short_suffix

Suffix to add when character values are shorten. Default to "...".

do_autofit

Use autofit() before rendering the table. Default to TRUE.

show_coltype

Show column types. Default to TRUE.

color_coltype

Color to use for column types. Default to "#999999".

...

unused arguments

Examples

as_flextable(mtcars)

mpg

cyl

disp

hp

drat

wt

qsec

vs

am

gear

carb

numeric

numeric

numeric

numeric

numeric

numeric

numeric

numeric

numeric

numeric

numeric

21.0

6

160.0

110

3.9

2.6

16.5

0

1

4

4

21.0

6

160.0

110

3.9

2.9

17.0

0

1

4

4

22.8

4

108.0

93

3.9

2.3

18.6

1

1

4

1

21.4

6

258.0

110

3.1

3.2

19.4

1

0

3

1

18.7

8

360.0

175

3.1

3.4

17.0

0

0

3

2

18.1

6

225.0

105

2.8

3.5

20.2

1

0

3

1

14.3

8

360.0

245

3.2

3.6

15.8

0

0

3

4

24.4

4

146.7

62

3.7

3.2

20.0

1

0

4

2

22.8

4

140.8

95

3.9

3.1

22.9

1

0

4

2

19.2

6

167.6

123

3.9

3.4

18.3

1

0

4

4

n: 32