Error in aggregate.data.frame(as.data.frame(x), ...): arguments must have same length, with att_gt function
Matthew Barrera
I am new to econometrics and I am trying to perform a Group-Time Average Treatment Effects by using the function att_gt() from the did() library in R studio. I am trying to estimate the effect of mergers on R&D expenditures. I have a treatment group with mergers happening in 2014, 2015 and 2016 and a control group with no mergers happening. For both treatment and control I have data either for 2010-2018 or 2011-2019.
I get the following error : Error in aggregate.data.frame(as.data.frame(x), ...) : arguments must have same length
I created a subset with only the variables I am using in the code and made sure that they are all the same length. I also replaced all NAs with 0. However, I still get the same error. Does anybody have an idea what could be going wrong here?
This is my data
This is the code that I am using:
out <- att_gt(yname = "RD_Expense", gname = "treatment_year", idname = "Globa_Company_Key", tname = "Date_Year", xformla = ~SIC4 + ISO_Country_Code, allow_unbalanced_panel = TRUE, data = Mergers_dataset, )
summary(out)I am trying to run this code because I have 3 treatment periods and I cannot think of aanother way to perform difference-in-differences. If anyone has other suggestions that would be appreciated.
1 Related questions 0 Error in aggregate.data.frame(as.data.frame(x), ...) : arguments must have same length 0 Error in table: all arguments must have the same length 12 Error in aggregate.data.frame : arguments must have same length Related questions 0 Error in aggregate.data.frame(as.data.frame(x), ...) : arguments must have same length 0 Error in table: all arguments must have the same length 12 Error in aggregate.data.frame : arguments must have same length 911 data.table vs dplyr: can one do something well the other can't or does poorly? 2 SummaryBy - "arguments must have same length" 2 R - complete.cases not all arguments have the same length 0 Error: Arguments 'event.e' and 'subgroup' must have the same length 262 How can I plot two histograms together in R? 14 'x' and 'w' must have same length - error in weighted.mean.default Load 6 more related questions Show fewer related questions Reset to default