davidgohel / ReporteRs

Note that ReporteRs has been removed from CRAN the 16th of July 2018 and is not maintained anymore. please migrate to officer.
245 stars 44 forks source link

How to change header content? #192

Closed eusebe closed 7 years ago

eusebe commented 7 years ago

Hi,

I would like to replace the default header names of a FlexTable object (after its creation).

I tried

ft <- FlexTable(head(esoph))
ft[1, , to = "header"] <- c("A", "B", "C", "D", "E")

But the result is not exactly what I expected;

agegpA

alcgpB

tobgpC

ncasesD

ncontrolsE

25-34

0-39g/day

0-9g/day

0

40

25-34

0-39g/day

10-19

0

10

Is it possible to obtain the following?

A

B

C

D

E

25-34

0-39g/day

0-9g/day

0

40

25-34

0-39g/day

10-19

0

10

Best, David

davidgohel commented 7 years ago

Hi David

Yes, set no row header with header.columns = FALSE then use addHeaderRow :

MyFTable <- FlexTable( data = iris[46:55, ], header.columns = FALSE )
MyFTable <- addHeaderRow( MyFTable, value = c("A", "B", "C", "D", "E") )

David

eusebe commented 7 years ago

So, it means that it is impossible to remove header after the creation of the FlexTable object?

davidgohel commented 7 years ago

yes