Hi all,
I'm trying to remove duplicates in my dataset, but it's not working. I'm using the following function:
CapitalIQ <-
CapitalIQ %>%
group_by(companyname, interestratehighvalue, fyear) %>%
Eliminate firm years with duplicate
filter(n() == 1)
So what I want is that for each fyear and gvkey, I want to remove the duplicates based on the variable interestratehighvalue.
But if I run this code it removes a lot more than what I wanted.
Could anyone help me or give some tweaks to my code?