Get some Shiny stuff going.

This commit is contained in:
Matt
2016-04-14 17:08:05 -05:00
parent f3a565aa98
commit 881c635ad7
4 changed files with 48 additions and 27 deletions

View File

@ -2,13 +2,41 @@
# This is the server logic of a Shiny web application. You can run the
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Use https://github.com/maxconway/gsheet
library(gsheet)
# Use the functions in ledgerr (the package that is part of this project) but don't load the package itself--this will let us deploy to Shiny.io more easily.
library(R.utils) #for sourceDirectory()
sourceDirectory("ledgerr/R")
# Pull Google sheet locations from another file (journal1, journal2, etc.)
source("config.R")
# Combine bank accounts
journal<-rbind(journal1,journal2)
## Clean up
# Date is date
journal$Date<-as.Date(journal$Date,format="%m/%d/%Y")
# Replace empty classes and accounrs
journal$Class[journal$Class==""]<-c("unclassified")
journal$Account[journal$Account==""]<-c("unclassified")
# Class, Accounts are factors
journal$Class<-as.factor(journal$Class)
journal$Account<-as.factor(journal$Account)
# Empty class should be NA
# Debit and Credit are numeric, without commas
journal$Debit<-as.numeric(sub(",","",journal$Debit))
journal$Credit<-as.numeric(sub(",","",journal$Credit))
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
@ -23,4 +51,9 @@ shinyServer(function(input, output) {
})
# Show journal
output$mytable = renderDataTable({
journal
})
})