writeExcel: Save the 'OUTPUTS' to an Excel file

View source: R/rmd.util.r

writeExcelR Documentation

Save the OUTPUTS to an Excel file

Description

While writing the OUTPUTS to an Excel file, column oFileName is embedded with URL file.path(df1[,"oPath"],df1[,"oFileName"]).

Usage

writeExcel(fileName, ...)

Arguments

fileName

(character) The name of the Excel file with extension 'xlsx'. Can contain relative or absolute file paths.

...

parameters passed to write.xlsx

Details

It is not a general function to save a data.frame or matrix to an Excel file. And there is no append mode; the target file will be covered if already present.

Value

none

See Also

write.xlsx

Examples

  library(wfr)
  library(openxlsx)
  library(ggplot2)
  df1=data.frame(A=c("a","a","b3"),
                 B=c("b1","b2","b3"),
                 C1=1:3,C2=2:4)
  colWidth = "2,1,1,1"
  header = "A | A | C | C || A | A | C1 | C2"
  footer = "A|Arkansas$~ref$|1|header
  || C1|Kansas$^ref$|x|header
  || a|Arizona|2|body"

  
    tmpDir = tempdir()
    ofn = file.path(tmpDir, "tab.1.csv")
    saveOutput(df1,ofn,caption = "1st testing table",header = header,
               footer = footer,colWidth = colWidth,fontSize = 12 )

    saveOutput(qplot(1:10,1:10),oPath=tmpDir,caption = "1st testing fig")

    fn1=file.path(tmpDir, "output.xlsx")
    writeExcel(fn1)
    df2=read.xlsx(fn1)
  


blueskypie/wfr documentation built on Feb. 6, 2024, 4:38 p.m.