NickCH-K/did

Data checks needed before sending data to R

Closed this issue · 1 comments

If using data with a date variable that is a Stata formatted date (i.e. anything outwith yearly) then the package chokes. It fails to recognise that the formatted dates are numbers.
The date variable needs to be reformatted:

format date' %9.0gotherwise R throws the following error code (even when never treateds are set to be 0):Error in pre_process_did(yname = yname, tname = tname, idname = idname, : There is no available never-treated group`

Similarly, if the idname is a labelled variable R doesn't like it:

Error in pre_process_did(yname = yname, tname = tname, idname = idname, : data[, idname ] must be numeric

So a tempvar must be created to parse which is stripped of the value labels to allow R to run att_gt.

Thank you! Trying to wade into getting the dates to convert properly seems error-fraught so in f2a307b
I've just added a note to the documentation that the time variable should be numeric. I've also fixed the labeled-values issue, but now there's a problem if you WANT a labeled variable to be a factor. Working on that, too.