I have a field (variable) data2$DatumZalozenia
with dates as follows 06.12.2013
. Format of the values in the variable is DD.MM.YYYY
. The variable is type chr
.
I need to extract the year out of the date and create new variable data2$RokZalozenia
in a format YYYY
. I need to do that in R. Can somebody please help me on this?
data2$RokZalozenia <- as.Date((data2$DatumZalozenia), format = "%d.%m,%Y")