Merge & Center data in excel

The data I have downloaded has some values which are "Merge & Center" in excel. While importing the data in R, I am getting the values which are merged in excel as NA.

How can I import the data properly which I can use for analysis?

There will be no way to help you without more context/detail on the shape and form of that data. Several things might be coercing those values into NA


Above is the data sheet where the values which have been merged do not appear when the data is input in R (below screenshot).

Hope this clarifies my query.

It is not immediately apparent what is going wrong. Can you send a small portion of it in .xlsx form so I can reprex it?

openxlsx::read.xlsx(xlsxFile = "your path here",
                    fillMergedCells=TRUE)
1 Like

In Excel , merged cell will hold value only in the first cell and Excel then formats the view to show the cell value across other cells. Un-merge the cells and you will see the value retained in first cell only.

Hence when its imported to R or any other tool it will retain values in first cell while other cells will be empty or NA.
The easiest option for you to import the excel file as-is and use the "fill()" function from dplyr to fill down the values.
Pls view the help at "Fill function"

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.