Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dt.res <- dt.cj[Analys.x < Analys.y, .(cnt = length(unique(CUSIP.x))),by = .(Fdate, Analys.x, Analys.y)]```
- ```dt <- data.table(CUSIP = c(1,1,1,1,2,2,2,2,2,2), Fdate = c("2000-12-31","2000-12-31","2001-12-31","2001-12-31","2000-12-31","2000-12-31","2000-12-31", "2001-12-31", "2001-12-31", "2001-12-31"), Analys = c(7649, 9845, 44283, 7649, 9845, 37856, 63528, 9845, 88254, 88254))```
- CUSIP = Unique ID for a company
- Fdate = The date the forecast is based for
- Analys = The ID of a analyst
- ```output <- data.table(Reg.ID = c(1,1,2,2), Location = c("2000-12-31","2001-12-31"), Count = c(2,2,3,2))```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement