Ok a create 17 vectors (o1, o2, ..., o17) for a accounting exercise. Each vector has 3 elements account(character), T operation(character), and Value (numeric). I use rbind and data frame it. so I had this.
Account T operation Value
o1 Cash Debit 100000
o2 Paid in Capital Credit 10000
o3 PP&E Debit 10000
o4 Cash Credit 10000
o5 Cash Debit 48000
o6 COGS Debit 24000
o7 Revenue wardrobes 1stY Credit 48000
o8 Inventory wardrobes 1stY Credit 24000
o9 Cash Debit 20000
o10 COGS Debit 10000
o11 Revenue bookcases 1stY Credit 20000
o12 Inventory bookcases 1stY Credit 10000
o13 Operating expenses Debit 30000
o14 Cash Credit 20000
o15 Accounts Payable Credit 10000
o16 Depreciation Expense Debit 1000
o17 Accumulated depreciation 1stY Credit 1000
but I want to sum credits and debits with if and else. I will not describe my function because could have a lot of errors and for my experts' brothers, I suppose that some 3 lines of code I could get the answer.