0

The date format within the .xlsm file is "01.04.2020" which means %d.%m.%y.

read_excel imports this as 43922. How can I avoid this?

I have to add, the according column has a string as a header (which is quite common). I changed the column now to:

df[, 16]
  [1] ""      ""      ""      ""      ""      ""      ""      ""      ""      ""      ""      ""      ""     
 [14] ""      ""      ""      ""      ""      ""      ""      ""      ""      ""      ""      ""      ""     
 [27] ""      ""      ""      ""      ""      ""      ""      ""      ""      ""      "42865" "43018" ""     
 [40] "43059" "43042" "43042" "42983" ""      ""      ""      ""      "43152" ""      "43112" "43112" "43138"
 [53] "43129" "43111" "43111" "43145" "43145" "43145" "43157" "43172" "43118" "43116" "43203" "42856" "43171"
 [66] "42870" "43082" "43227" "43227" "43237" "43217" ""      "43102" "43059" "43018" ""      "42870" "42766"
 [79] ""      "43124" "43178" "43252" "43252" "43259" "43262" "43264" "43271" "43287" "43287" "43287" "43287"
 [92] "43287" "43293" "43301" "43308" "43307" "43304" "43304" "43294" "43321" "43332" "43336" "43336" "43341"
[105] "43341" "43348" "43348" "43348" "43348" "43348" "43350" "43360" "43368" "43378" "43390" "43390" "43396"
[118] "43397" "43411" "43406" "43416" "43417" "43419" "43416" "43416" "43423" "43430" "43430" "43431" "43431"
[131] "43439" "43473" "43468" "43468" "43468" "43467" "43473" "43488" "43488" "43490" "43523" "43523" "43516"
[144] "43537" "43507" "43549" "43529" "43529" "43552" "43552" "43552" "43552" "43550" "43564" "43565" "43565"
[157] "43565" "43565" "43557" "43564" "43564" "43567" "43570" "43565" "43594" "43594" "43613" "43620" "43620"
[170] "43620" "43620" "43621" "43634" "43634" "43634" "43635" "43635" "43635" "43641" "43641" "43641" "43640"
[183] "43657" "43657" "43654" "43647" "43669" "43676" "43676" "43675" "43684" "43684" "43690" "43682" "43682"
[196] "43707" "43707" "43710" "43710" "43710" "43710" "43685" "43693" "43686" "43686" "43686" "43686" "43686"
[209] "43725" "43762" "43753" "43705" "43767" "43767" "43749" "43767" "43733" "43790" "43802" "43802" "43802"
[222] "43802" "43803" "43812" "43812" "43832" "43832" "43839" "43839" "43839" "43839" "43857" "43859" "43800"
[235] "43814" "43687" "43675" "43860" "43893" "43893" "43894" "43903" "43903" "43903" "43903" "43903" "43916"
[248] "43916" "43916" "43916" "43923" "43923" "43923" "43923" "43927" "43927" "43924" "43924" "43963" "43936"
[261] "43903" "43957" "43957" "43957" "44005" "44011" "43977" "43977" "44004" "44004" "44068" "44068" "44084"
[274] "44067" "44113" "44145" "44117" "44117" "44113" "44169" "44280" "44280" "44298" "44343" "44343" "44348"
[287] "44397" "44484" "44484" "44473" ""      ""      ""      ""      ""      ""      ""      ""      ""     
[300] ""      ""      ""      ""    

which results in

df[5:nrow(df), 16]<- as.Date(df[5:nrow(df), 16], origin = "13.10.2021")
Error in charToDate(x) : 
  String is not in a unique standard format

equivalent to

> df[38, 16]
[1] "43018"
> 
> as.Date(df[38, 16], origin = "13.10.2021")
Ben
  • 1,432
  • 4
  • 20
  • 43

0 Answers0