I currently am importing two tables (in the most basic form) that appear as such
Table 1
State Month Account           Value
NY    Jan   Expected Sales    1.04
NY    Jan   Expected Expenses 1.02
Table 2
State Month Account    Value
NY    Jan   Sales      1,000
NY    Jan   Customers  500
NY    Jan   F Expenses 1,000
NY    Jan   V Expenses 100
And my end goal is to create a 3rd data frame that includes the values of the first two rows and calculates a 4th column based off of functions
NextYearExpenses = (t2 F Expenses + t2 V Expenses)* t1 Expected Expenses
NextYearSales = (t2 sales) * t1 Expected Sales
So my desired output is as followed
State Month New Account Value
NY    Jan   Sales       1,040
NY    Jan   Expenses    1,122
I am relatively new to R and I think ifelse statements might be my best bet. I have tried merging the tables and calculating with simple column functions but with no real progress.
Any suggestions?
 
     
     
     
    