I have a data.frame that looks something like this:
data <- data.frame(X = c("A", "B", "C", "D", "E"),
Y = c(1,1,2,2,3),
Choice1.a = c(2,2,2,3,3),
Choice1.b = c(5,6,5,5,6),
Choice2.a = c(1,1,1,2,2),
Choice3.b = c(6,6,5,5,6))
I would like to save it to an excel file so that it looks something like this:

Does anyone know if this is possible?
If it's not, I would settle for just changing the "." delimiter to " " in the excel file.

I would solve the problem at hand with two sections. A header, consisting of rows 1 and 2, and the body consisting of the remaining rows starting at 3. Using
openxlsx20.6.1 (currently in CRANs incoming queue) the table is recreated as follows.