table2tabs: Parse Excel tables from one sheet to named tabs

View source: R/table2tabs.R

table2tabsR Documentation

Parse Excel tables from one sheet to named tabs

Description

Parses tables from one Excel sheet based on an identifier, empty rows/columns must be left between tables as these are used for edge detection by the is.na() function. Each table on the sheet should have column"" names, the first is used for identification of tables, the second for tab names. This is a tool used at our lab for quickly writing comparisons for the RNAseq analysis and then converting them to multiple tabs. The typical format is; colnames: "ID", "comparison_name", where ID designates the sample ID's and comparison_name designates test/control.

Usage

table2tabs(file, output, table_id = "ID", return = FALSE, ...)

Arguments

file

[type: character] Path to a file type xlsx.

output

[type: character] The name of the output file - must have extension .xlsx.

table_id

[type: character, default: "ID"] This is used for identifying the individual tables on a single sheet.

return

[type: logical, default: FALSE] If TRUE returns the parsed data.

...

Extra arguments to passed to openxlsx::saveWorkbook

Details

Note that you can have other content on your excel sheet as long as it does not contain the table_id string used for parsing.

Value

Returns if return argument set to TRUE; a list of data.frames - might be useful for analysis - the primary output is the file output.

Examples

path <- system.file("extdata", "comparisons-setup.xlsx", package = "derecksLabTools")
table2tabs(
    file = path,
    output = "output-file.xlsx",
    table_id = "ID",
    return = FALSE,
    overwrite = TRUE
)


CoarfaBCM/derecksLabTools documentation built on April 3, 2022, 10:29 p.m.