I have a Microsoft Excel (.xlsx) file which I would like to load into R. I've done this before and used read.csv(), which always worked fine, but with this file something strange happens. Something seems to go wrong with one column, which contains a row name and large numbers with values of 13 digits. This column is - no matter how I try to load the file into R - converted to its scientific notation.
The problem can be simulated as follows: in Excel, type in the first column first
row, a random row name. Type in the first column second row a random big number, e.g. 6345157890027. Then save the file as .csv. Let's suppose I want to open this file in R:
TestData <- read.csv(file = "Test.csv", head = TRUE) and then
View(TestData)
The number 6345157890027 is now displayed as 6.345158e+12, and information is lost somewhere during import. Now, I've tried to solve this multiple ways:
- In both the .xlsx and the .csv file, I converted the row into number format
- Tried all .csv formats that Excel allows me to save it in
- Copied the whole worksheet to a new Excel file
- Used the Import Data function in Excel
- Save the worksheet as .txt and import this into R using File->Import Dataset function
However, none of these solved the problem: the value always seems to appear in scientific notation. Does someone knows a way to make sure either Excel or R does not transform large numbers into scientific notation?