Creating dummy variables I have a Eurobarometer dataset and want to eventually create a logistic regression model and a linear probability model using a set of dates as the dependent variable.
However, the dates in the dataset are displayed as long descriptors such as &quot;Sunday 21st May 2005&quot; in a column labelled v584 .

How can I create a dummy variable to say 0 = before Sunday 29th May 2005, 1 = after Sunday 29th May 2005 from the dates listed?

And how can I include only specific date (E.g., only including the dates a week before &quot;Sunday 29th May 2005&quot; in 0 and only the dates a week after in 1)?
The lubridate package provides functions to easily convert character strings into dates in a sensible way. For example, the dmy function can parse strings in a variety of formats so long as the string is in the order of day-month-year. The lubridate functions handle all sorts of separators and extraneous characters.
As for your dummy variable, after you convert your v584 column into dates, just create a new column:
new_column &lt;- as.integer(v584 &gt; dmy(&quot;Sunday 29th May 2005&quot;))