I want to create a new variable in my data table in R that will be equal to 1, if the date of the event is after a certain time (2019-01-01) and will be equal to 0 otherwise. I am using the following code:
dt$time <- ifelse[dt$date > '2019-01-01',1,0]
But I am getting a mistake:
object of type 'closure' is not subsettable.
To be honest, I don't understand what is wrong.
Aucun commentaire:
Enregistrer un commentaire