I received hundreds of Excel sheets containing merged cells. Sender insists on using Excel and merging cells - nothing I can do about that. How do I read these using R? For example, a simplified version of the problem area of the input sheet might look something like this, where the merged cells (B2,B3,C2,C3) contain the word "X". The number of merged cells and their location in the sheet (and the value of "X") changes from sheet to sheet, and there may be more than one set of merged cells in the same sheet. The sheets are not actually in tabular format, and they contain other empty cells. I have successfully looped through all the files, cleaned up the whole mess, reshaped the result and obtained a tidy dataset (1 sheet instead of 736 Excel workbooks). The problem is, my solution so far ignores the information in the merged cells.
A B C D
1 a f i l
2 b X m
3 c n
4 d g j o
5 e h k p
How can I read the Excel sheet into R so that the result looks like this, with the word "X"
A B C D
1 a f i l
2 b X X m
3 c X X n
4 d g j o
5 e h k p