I like the xlsx package in R for its simplicity. However, I would always have a problem reading columns as numeric with the
read.xlsx reads numeric columns properly, but it’s slow for large data sets.
read.xlsx2 doesn’t guess the type of each column so it just reads everything as strings. It’s not immediately obvious from the documentation how to fix this without a bit of extra digging.
You actually have to look into the documentation of
readColumns to see that if you pass
colClasses=NA then it will guess the column type
So, use this:
data = read.xlsx2("path_to_xlsx_file.xlsx", sheetIndex=1, colClasses=NA)