I have a single data frame consisting of x unique combinations of region and channel. I need to create a distinct regression model for each the x combinations using some sort of a loop.
region  channel         date         trials    spend    
EMEA    display       2015-01-01       62     17875.27   
APAC    banner        2015-01-01       65     18140.93
Something to the effect of
i=1
j=1
for r in region{
   for ch in channel{
       df1 = df[df$region == r & df$channel == ch, ]
       model[[i,j]] = lm(trials ~ spend, data = df1)
                      j = j+1}
                i = i+1 }
If someone also knew a way of storing a unique identifier such as region+channel to help identify the regression models that would be very helpful too.
 
     
    