Q:

error converting factor to date

           Date  Open  High   Low Close     Volume
1    02/01/2007 32,92 34,53 32,58 34,53   28863,00
2    03/01/2007 35,25 36,44 34,60 36,44  173949,00
3    04/01/2007 35,88 36,38 35,15 36,25   88676,00
4    05/01/2007 36,80 37,23 35,82 36,90   38778,00
5    08/01/2007 37,04 37,50 35,68 36,97   51075,00
6    09/01/2007 37,23 39,54 37,23 39,54  282032,00
7    10/01/2007 39,18 39,54 38,88 39,05  438456,00
8    11/01/2007 39,05 39,87 37,70 39,54   76578,00
9    12/01/2007 40,07 42,08 39,54 41,71  362448,00
10   15/01/2007 41,52 46,13 41,52 45,01  324165,00

I would like to convert Date above from class factor to Date by
date <- as.Date(dane$Date,format="%d/%m/%y")

The result looks like this:
 [1] "2020-01-02" "2020-01-03" "2020-01-04" 
   "2020-01-05" "2020-01-08" "2020-01-09" "2020-01-10" 
   "2020-01-11" "2020-01-12" "2020-01-15"

I don't understand why the results are wrong.

A:

You're using the date format flag for a 2-digit year. See this list of date format flags.
Try a capital Y instead:
date <- as.Date(dane$Date,format="%d/%m/%Y")

