[R] readxl, read_excel: how colon (:) is read ?

Patrick Giraudoux p@tr|ck@g|r@udoux @end|ng |rom un|v-|comte@|r
Fri Apr 1 08:12:28 CEST 2022


I have a unexpected behaviour reading times with colon from an Excel 
file, using the package readxl.

In an Excel sheet, I have a column with times in hours:minutes, e.g:

Arrival_time
13:39
13:51

When read from R with readxl::read_excel, this gives a tibble column 
with full date by defaut being the last day of 1899. OK. Why not, I know 
that POSIX variables are starting in 1900 after R doc (however I wonder 
why here the defaut is one day before January 1, 1900

> tmp$Arrival_time  [1] "1899-12-31 13:39:00 UTC" "1899-12-31 13:51:00 UTC"

Well, this is not exactly what I want to. I do not care about the year 
and the day... Therefore I decided to import this column as "text" 
explicitely (in order to manage it within R then). And this is what I 
get now:

> read_excel("saisie_data_durban_rapaces_LPO.xlsx",sheet=2,col_types="text")  > tmp$Arrival_time [1] "0.56875000000000009" "0.57708333333333328"

Can someone tell me what happens ?

I would really appreciate to understand the trick...


	[[alternative HTML version deleted]]



More information about the R-help mailing list