So basically, there is some work I have to do with a huge data-set.
I extracted tables with two different variables within the dataframe, to get Frequency.
For example:
table1<-table(df1$vehicletype,df1$company)
# let's say table 1 looks something like this
1 2 3 4 5 6 7
1 1 2 3 1 2 6 4
2 3 4 3 4 1 2 3
3 4 6 3 5 6 7 8
table2<-table(df1$vehicletype2,df1$company2)
1 3 4 5 6 7
1 3 1 4 1 5 6
2 6 3 6 2 0 0
3 4 3 6 3 2 1
now I want to merge these two tables, although there are only 6 columns in table 2 (2nd column is missing) and I want that the corresponding values are added together, the table should look something like this:
1 2 3 4 5 6 7
1 4 2 4 5 3 11 10
2 9 4 6 10 ......
3 ...............
So basically, I want to be able to detect that over the two days, there were in total 9 vehicles used of vehicletype 2 and vehiclecompany 1. I want the function to understand, that there are simply no cars from company 2 used on the second day and just use the value 0 for the column.
The real case scenario, which is not simplified goes over a bigger time range and has more tables that need to be added with missing columns and rows.
Does anybody have an idea?
Thank you
I tried different stuff I found on StackOverflow, couldn't solve the issue tho.