I have two tables: restaurant_trans
and restaurant_master
restaurant_trans
has name, date, net_sales
This is a transaction file with sales for 50 restaurant recorded for 30 days each (1500 obs).
restaurant_master
has name, go.live.date, franchise
This is a master file with name of the restaurant and 'go.live.date' is the date a particular device was installed in the restaurant.
I want to find the net sales of the restaurant before and after the device was installed. I first want the data to be grouped.
I tried this code for subsetting the data
dummayvar = 0;
for (i in 1:nrow(restaurant_master)){
for (j in 1:nrow(restaurant_trans)){
if(restaurant_trans$Restaurant.Name[j]==restaurant_master$Restaurant.Name[i]){
if(restaurant_trans$Date[j] < restaurant_master$Go.Live.Date[i]){
append(dummayvar, restaurant_trans$Date)
}
}
}
}
This is giving an error :
"level sets of factors are different"
Please help!!