I am trying to incorporate date in a column. But it is returning number since NA is present. Can anyone help me?
asdd <- data.frame(a = c(NA,as.Date(today(),"%m/%d/%Y")), b = c(2,3))
asdd
a b
1 NA 2
2 19220 3
i want get as Date in the column?
>Solution :
Place the as.Date before c and not inside c.
data.frame(a = as.Date(c(NA, "1970-01-01")), b = c(2,3))
# a b
#1 <NA> 2
#2 1970-01-01 3