how can i modify the names to date format and put them in a column as dates?
names(df) [6] "X1.23.20" "X1.24.20" "X1.25.20" "X1.26.20" "X1.27.20" [11] "X1.28.20" "X1.29.20" "X1.30.20" "X1.31.20" "X02.01.2020" [16] "X02.02.2020" "X02.03.2020" "X02.04.2020" "X02.05.2020" "X02.06.2020" [21] "X02.07.2020" "X02.08.2020" "X02.09.2020" "X02.10.2020" "X02.11.2020" [26] "X02.12.2020" "X2.13.20" "X2.14.20" "X2.15.20" "X2.16.20" [31] "X2.17.20" "X2.18.20" "X2.19.20" "X2.20.20" "X2.21.20" [36] "X2.22.20" "X2.23.20" "X2.24.20" "X2.25.20" "X2.26.20"
You can use as.Date with specified format, e.g.,
as.Date
> as.Date(v,"X%m.%d.%y") [1] "2020-01-23" "2020-01-24" "2020-02-02" "2020-02-03"
data
v <- c("X1.23.20","X1.24.20","X02.02.2020","X02.03.2020")
1.4m articles
1.4m replys
5 comments
57.0k users