I have an Excel file with data (5 columns and 200 rows).
Rows are the next:
TransactionId
, UserId
, transaction_date
, transaction_status
, amount_USD
.
The data.table is like that (it is not full, just to catch the idea):
Screenshot of datatable1
The task is rearrange the table in way it will look like 3 columns (transaction_date, CHARGED, DECLINED), where CHARGED and DECKLINED - are the sum of all amount_USD by the same date with specific status (Charged or Declined).
So, it should look like that:
And also, when I use such code for importing from Excel - is it correct?
> library("xlsx")
> data1 <- read.xlsx("d:/R/1.xlsx", 1)