Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Look at Mint transaction data via R
## Load libraries
if (!require(readr)) { install.packages("readr") }; library(readr)
if (!require(magrittr)) { install.packages("magrittr") }; library(magrittr)
if (!require(dplyr)) { install.packages("dplyr") }; library(dplyr)
if (!require(tibbletime)) { install.packages("tibbletime") }; library(tibbletime)
if (!require(lubridate)) { install.packages("lubridate") }; library(lubridate)
if (!require(devtools)) { install.packages("devtools") }; library(devtools)
if (!require(shinyview)) { install_github("peterhurford/shinyview") }; library(shinyview)
## Load Mint transactions
trans <- read_csv("~/Downloads/transactions.csv")
## Parse it into dataframe
trans <- trans %>%
mutate(Date = as.Date(Date, "%m/%d/%Y")) %>%
as_tbl_time(index = Date) %>%
mutate(moy = month(Date)) %>%
time_filter(2017-08 ~ 2017-10)
## Look at amount by category by month for August - October 2017
trans %>%
group_by(moy, Category) %>%
summarise(total = sum(Amount)) %>%
arrange(-moy) %>%
shiny_view
## Look at individual transactions
trans %>% time_filter(2017-08 ~ 2017-10) %>%
select(Date, moy, Amount, Description, Category) %>%
arrange(-moy, Category) %>%
shiny_view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment