Export R data to Excel formatted

6

Assume a data.frame like this:

tabela <- structure(list(vendedor = structure(1:4, .Label = c("A", "B", 
"C", "D"), class = "factor"), Total = c(3300, 440, 1020, 200)), .Names = c("vendedor", 
"Total"), row.names = c(NA, -4L), class = c("tbl_df", "tbl", 
"data.frame"), drop = TRUE)

How to export it in Excel, putting details like title, subtitle, formatting of sizes and fonts of texts and numbers? In this question are package suggestions to save in Excel, however it is not about how to format the data.

    
asked by anonymous 23.04.2014 / 02:08

1 answer

4

With the WriteXLS package, you can do some things.

The syntax is this:

WriteXLS(x, ExcelFileName = "R.xls", SheetNames = NULL, perl = "perl",
verbose = FALSE, Encoding = c("UTF-8", "latin1"),
row.names = FALSE, col.names = TRUE,
AdjWidth = FALSE, AutoFilter = FALSE, BoldHeaderRow = FALSE,
FreezeRow = 0, FreezeCol = 0,
envir = parent.frame())
  • If AdjWidth = TRUE , adjust the width of each column by the longest value.

  • If AutoFilter = TRUE , worksheet xlx already exits with autofilter

  • If BoldHeaderRow = TRUE , name of each column in bold

The commands FreeRow and Freezecol indicate which columns should be frozen.

    
05.07.2014 / 16:34