Spending your days R but working closely with analysts and leadership that live in Excel? Get familiar with openxlsx.
openxlsx
is an awesome package for writing multiple datasets to multiple sheets of an Excel workbook, and allows for robust styling and cell formatting. I found a tutorial on RPubs written by Ezekiel Adebayo Ogundepo covering this package that I often use at work. Definitely bookmark worthy.
Here is a high-level code example:
library(openxlsx)
# Name the Excel worksheets where you want to export data to
<- list("Overall Summary" = df_1, "LOB Summary" = df_2, "Details" = df_3)
list_of_datasets
# Save the Excel workbook to your wd with your worksheet list and name the Excel file
write.xlsx(list_of_datasets, "Excel_Workbook_2017.01.20.xlsx")
Links:
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Orraca (2020, Jan. 9). Javier Orraca: Writing to Excel from R. Retrieved from https://www.javierorraca.com/posts/2020-01-09-Writing-to-Excel-from-R/
BibTeX citation
@misc{orraca2020writing, author = {Orraca, Javier}, title = {Javier Orraca: Writing to Excel from R}, url = {https://www.javierorraca.com/posts/2020-01-09-Writing-to-Excel-from-R/}, year = {2020} }