create_wb: create_wb - Create a Workbook with Multiple Worksheets Using...

Description Usage Arguments Examples

View source: R/create_wb function using openxlsx.R

Description

create_wb - Create a Workbook with Multiple Worksheets Using 'openxlsx'

Usage

1
2
3
4
create_wb(filename = "Test", dataframe_list,
  tabnames = LETTERS[1:length(dataframe_list)],
  format_column_labels = TRUE, ws_type = "table",
  output_path = getwd(), open_wb = TRUE, overwrite_existing = TRUE)

Arguments

filename

The worksheet name you would like. Will be appended with a date stamp.

dataframe_list

A list of dataframes (without quotes) created outside the function call.

tabnames

A vector of tabnames, current maximum # tabs supported = 8.

format_column_labels

TRUE or FALSE.

ws_type

"table" or "standard".

output_path

Location where you want the workbook to be saved.

open_wb

If TRUE, open the workbook for review.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(WorksheetFunctions)
df1 <- smutilities::create_tbl_df(fill_value=0, nrows=10, ncols=10)
df2 <- smutilities::create_tbl_df(fill_value="A2", nrows=10, ncols=10)
df3 <- smutilities::create_tbl_df(fill_value="Test", nrows=10, ncols=10)
stub_colnames <- rep(c("Test.Name", "Test_Name", "test.Name",
                       "test_NAMe", "test.NAME"), 2)
stub_colnames <- paste(stub_colnames, 1:length(stub_colnames), sep=" ")
names(df1) <- stub_colnames
names(df2) <- stub_colnames
names(df3) <- stub_colnames

dataframes <- list(df1, df2, df3)

create_wb(filename = "Test_New",
          dataframe_list = dataframes,
          tabnames=LETTERS[1:length(dataframe_list)],
          format_column_labels=TRUE,
          ws_type = "table",
          output_path=getwd(),
          open_wb = TRUE,
          overwrite_existing=TRUE)

johnfrye/WorksheetFunctions documentation built on May 9, 2020, 7:11 p.m.