Revisión | 5d36c5e195f345421efd8bf7ab807bfa420bab74 (tree) |
---|---|
Tiempo | 2025-01-16 18:23:03 |
Autor | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
I improved the treatment of the date field.
@@ -21,6 +21,9 @@ | ||
21 | 21 | na_num_to_pattern(0) |
22 | 22 | |
23 | 23 | |
24 | + | |
25 | + | |
26 | + | |
24 | 27 | df_long <- df |> |
25 | 28 | select(-c(type, currency)) |> |
26 | 29 | pivot_longer(cols=c(amount, fees_taxes, net), names_to="transaction_type", |
@@ -32,7 +35,15 @@ | ||
32 | 35 | mutate(title2=retain_pattern(title2, "Partial refund for Order")) |> |
33 | 36 | mutate(title2=retain_pattern(title2, "Listing fee")) |> |
34 | 37 | mutate(title2=retain_pattern(title2, "Transaction fee")) |> |
35 | - rename("transaction_type_new"="title2") | |
38 | + rename("transaction_type_new"="title2") |> | |
39 | + mutate(day_month_year=dmy(date)) |> | |
40 | + mutate(year=year(day_month_year)) |> | |
41 | + mutate(month=month(day_month_year)) | |
42 | + | |
43 | + | |
44 | + | |
45 | + | |
46 | + | |
36 | 47 | |
37 | 48 | df_tran <- df_long |> |
38 | 49 | summarise(total=sum(value_eur), .by=transaction_type) |