oercim
oercim

Reputation: 1848

converting factor data frame to date data frame

I have such a data frame(df) which is just a sample:

df<- as.data.frame(as.factor(
c("16.04.2015", "04.08.2014", "11.09.2013",  "20.11.2015", "04.04.2014")))

How can I change this data frame into date formatted data frame. I will be very glad for nay help. Thanks a lot.

Upvotes: 0

Views: 98

Answers (1)

DatamineR
DatamineR

Reputation: 9618

Try the following:

df[] <- as.Date(df[,1], format = "%d.%m.%Y")

Upvotes: 2

Related Questions