Вы можете использовать createStyle
в openxlsx
упаковке.
library(openxlsx)
# sample data
my_data <- data.frame(nam1 = 1:12, nam2 = month.abb, stringsAsFactors = FALSE)
# create workbook
wb <- createWorkbook()
# add Excel sheet
addWorksheet(wb, "A")
# create style, in this case bold header
header_st <- createStyle(textDecoration = "Bold")
# Write data with header style defined above
writeData(wb, "A", my_data, headerStyle = header_st)
# save to .xlsx file
saveWorkbook(wb, "test.xlsx")