Exporting descriptives table to Exel format (.xlsx or .xls)

Share:

Description

This function takes the result of createTable and exports the tables to Excel format (.xlsx or .xls).

Usage

1
export2xls(x, file, which.table="descr", nmax=TRUE, header.labels=c(), ...)

Arguments

x

an object of class 'createTable'.

file

file where table in HTML format will be written. Also, another file with the extension '_appendix' is written with the available data table. If missing, the HTML code is returned.

which.table

character indicating which table is printed. Possible values are 'descr', 'avail' or 'both' (partial matching allowed), exporting descriptives by groups table, availability data table or both tables, respectively. Default value is 'descr'.

nmax

logical, indicating whether to show the number of subjects with at least one valid value across all row-variables. Default value is TRUE.

header.labels

see the 'header.labels' argument from createTable.

...

arguments passed to write.xlsx function.

Note

The way to compute the 'N' shown in the bivariate table header, controlled by 'nmax' argument, has been changed from previous versions (<1.3). In the older versions 'N' was computed as the maximum across the cells withing each column (group) from the 'available data' table ('avail').

To use this function you must have the xlsx package installed, which depends on rjava package.

See Also

createTable, export2latex, export2pdf, export2csv, export2md, export2word

Examples

1
2
3
4
5
6
7
## Not run: 
require(compareGroups)
data(regicor)
res <- compareGroups(sex ~. -id-todeath-death-tocv-cv, regicor)
export2xls(createTable(res, hide.no = 'n'), file="table1.xlsx")

## End(Not run)