Dummy Variable for dates before an after an event

Hi all,

I am completing a paper on the stock market and covid-19. I am trying to create a dummy variable so that all dates before an announcement = 0, all dates after=1.

Anyone know how I would go about this?

The purpose is to analyse how a stock price has changed due to a government announcement.

Any help would be much appreciated :slight_smile:

Something like:

cutoff.date = as.Date("2020-03-14")
my_data$cutoff.date.dummy = ifelse(my_data$date < cutoff.date, 0, 1)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.