dplyr allows the user to avoid loops.
The loops are replaced by group_by() if data is well gathered into a tidy data frame.
E.g.:
data <- data.frame(
date = rep(c(1,2,3,4), each=25),
Tickers = rep(c("A", "B", "C", "D")),
Returns = rnorm(100),
Weights = rnorm(100)
) %>% tbl_df()
data %>% group_by(date, Tickers) %>% do(head(.,2))
# Principle being:
data %>% group_by(date) %>% do(function(x))