tabs2table: Combine Excel sheets to single table

View source: R/tabs2table.R

tabs2tableR Documentation

Combine Excel sheets to single table

Description

Combine all sheets (tabs) from one or more Excel workbooks to a single table (an index is generated - first tab), padding is added (empty rows and columns) between the indvidual tables. This is useful for getting an overview of your data and avoiding having to click n tabs.

Usage

tabs2table(
  path,
  output = "compiled-comparisons.xlsx",
  columns = 3,
  return = FALSE,
  ...
)

Arguments

path

[type: character] A path to a directory; this will read all .xlsx files at this location.

output

[type: character, default: "compiled-comparisons.xlsx"] The name of the output file - must have extension .xlsx.

columns

[type: numeric, default: 3] Integer defines the number of columns to split the combined tables over. This splits the data and thus avoids having to scroll over a large amount of tables.

return

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

...

Extra arguments to passed to openxlsx::saveWorkbook

Value

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

Examples

dir.create("./test")
file.copy(system.file("extdata", "comparisons.xlsx", package = "derecksLabTools"), "./test")
tabs2table(
    path = "./test",
    output = "output-file.xlsx",
    columns = 3,
    return = FALSE,
    overwrite = TRUE
)

tabs2table(
    path = "./test/comparisons.xlsx",
    output = "output-file.xlsx",
    columns = 3,
    return = FALSE,
    overwrite = TRUE
)


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