I'm a newbee to R-programming and would like to thank this forum for the invaluable suggestions this forum provides.
I'm working on a Dataframe DF1 in below format
I'm trying to create another dataframe DF2 where the values of column "Description" of DF1 would have be the Column names in DF2 and the Credit and Debit values corresponding to the Decription would have to be captured accordingly (Credits as positive numbers and debits as negatives)
I would be very grateful if you could advise the logic of attaining this in R. Thanks in advance.
dput(DF1) is as below
structure(list(Account_number = c(1234, 1234, 1234, 3456, 3456,
4567, 4567), Credit = c(5.1, NA, 10, NA, 10, 5, NA), Debit = c(NA,
7.2, NA, 20, NA, NA, 30), Description = c("abc", "pqr", "xyz",
"xyz", "abc", "pqr", "abc")), .Names = c("Account_number", "Credit",
"Debit", "Description"), row.names = c(NA, -7L), class = c("tbl_df",
"tbl", "data.frame"))
Vish