I am using read.xlsx() function to read a xlsx file, with colNames = FALSE, rowNames = TRUE
arguments, everything was fine, but after adding a line of variable, it pops up error saying
Error in ".rowNamesDF<-"(x, value = value) :
missing values in 'row.names' are not allowed
When I check the problem byView()
and using rowNames = FALSE
, I found that the last row was introduced by a NA variable. However, since in the manual of read.xlsx() it doesn't say how to define a range, and I can't do like read.xlsx()[1:ncol(),]
either, so I don't know what to do.
My trials:
I tried to delete the last row in the xlsx file, but R keeps saying missing value is introduced.
I know I could use
rowNames = FALSE
argument first and remove the last row, and define first row as row.names(), but I don't want to do so because I think there is a better solution.