Search code examples
rdatedplyrlubridate

Create a column with a specific date


I am trying to create a column with this date within my dataset (08/12/2020). So far I've tried this:

df$datemaster = 1
caseDay <- ymd("2020-12-08")
df$datemaster = ifelse(df$datemaster == '1', caseDay, "no")

but this is clearly not right.

Could anyone help me? - I'd just need a column full of "2020-12-08" in my dataset.

Thanks


Solution

  • As @Waldi suggested, the answer to this is:

    df$datemaster <- ymd("2020-12-08")