0

I am trying to read an excel file in R. I used read_excel() function.

My excel file is full of numbers such as 18116.28 But R seems to recognize the numbers as date and time. R read this as 1949-08-06 06:49:24

Why does this happen? And how can I stop this?

Mir
  • 53
  • 6
  • You can specify the column types with `col_types` argument. See `help(read_excel())`. Edit: I considered you're using `readxl::read_excel()` – MonJeanJean Jul 28 '21 at 14:13
  • What package/function are you using to read in the Excel document? Have you looked at the help page for that function? Probably it has an argument about column classes... – Gregor Thomas Jul 28 '21 at 14:13
  • I am using readxl package and read_excel() function. – Mir Jul 28 '21 at 14:17
  • Thanks to your help, I tried read_excel(col_types = numeric) but it has another problem. R read numbers as numbers. But the decimal points are wrong. For example, the correct number is 18116.28 but R read it as 1.1811628e+0.4 – Mir Jul 28 '21 at 14:20
  • It's the same number, just expressed differently e.g. https://stackoverflow.com/questions/9397664/force-r-not-to-use-exponential-notation-e-g-e10 – Jonny Phelps Jul 28 '21 at 14:30
  • Thank you so much! All problems solved! – Mir Jul 28 '21 at 14:40

0 Answers0