1 | initial version |
To populate an Excel file from R, you can use the openxlsx package. Here are the general steps:
install.packages("openxlsx")
library(openxlsx)
wb <- createWorkbook()
sheet <- addWorksheet(wb, "Sheet 1")
writeData(sheet, mtcars)
saveWorkbook(wb, "myWorkbook.xlsx")
This will create an Excel file named "myWorkbook.xlsx" in your working directory with the data from the mtcars dataset in the first sheet. You can customize the sheet name, data range, and other options as needed.