Learn R Programming

compareGroups (version 4.5.1)

export2csv: Exporting descriptives table to plain text (CSV) format

Description

This function takes the result of createTable and exports the tables to plain text (CSV) format.

Usage

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

Arguments

x

an object of class 'createTable'.

file

file where table in CSV format will be written. Also, another file with the extension '_appendix' is written with the available data table.

which.table

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

sep

character. The variable separator, same as 'sep' argument from write.table. Default value is ','.

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.

...

other arguments passed to write.table.

See Also

createTable, export2latex, export2pdf, export2html, export2md, export2word

Examples

Run this code

if (FALSE) {
require(compareGroups)
data(regicor)
res <- compareGroups(sex ~. -id-todeath-death-tocv-cv, regicor)
export2csv(createTable(res, hide.no = 'n'), file=tempfile(fileext=".csv"))
}

Run the code above in your browser using DataLab