From 809b887c45ff7ae6d4b9595f38f6823b7e393d90 Mon Sep 17 00:00:00 2001 From: mattbk Date: Thu, 14 Apr 2016 15:55:38 -0500 Subject: [PATCH] Delete working.html Created accidentally. --- working.html | 257 --------------------------------------------------- 1 file changed, 257 deletions(-) delete mode 100644 working.html diff --git a/working.html b/working.html deleted file mode 100644 index 186899e..0000000 --- a/working.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - - - - - -Untitled - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - -

Should use this document for actual operations and keep actual functions in another document for the public GitHub repo. Shiny will be set up at https://www.shinyapps.io/admin/#/dashboard.

-
# Use https://github.com/maxconway/gsheet
-library(gsheet)
-
-# 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))
-
-## Temp function location
-# TODO learn where to store functions
-########## net() function, takes journal, class name(s), and date range as arguments
-net<-function(journ,classselect="all",accselect="all",dates="all"){
-  if("all" %in% classselect) {
-    classselect<-levels(journ$Class)
-  }
-  if("all" %in% accselect) {
-    accselect<-levels(journ$Account)
-  }  
-  if("all" %in% dates) {
-    dates<-c(min(journ$Date),max(journ$Date))
-  }
-  net<-sum(journ$Credit[journ$Class %in% classselect & journ$Account %in% accselect & journ$Date>=dates[1] & journ$Date<=dates[2]],
-           na.rm=T)-sum(journ$Debit[journ$Class %in% classselect & journ$Account %in% accselect & journ$Date>=dates[1] & journ$Date<=dates[2]],
-                        na.rm=T)
-  return(net)
-}
-##########
-
-########## Net table by class
-net.class<-function(journ,
-                    classselect="all",
-                    accselect="all",
-                    dates="all",
-                    total=F) {
-# List of classes
-  if("all" %in% classselect) {
-    classselect<-levels(journ$Class)
-  }
-# Set up data frame
-net.class.out<-data.frame(Class=character(),
-                        Net=numeric(),
-                        stringsAsFactors=FALSE)
-# Loop through classes, calculate net, and add to data frame
-for (i in 1:length(classselect)) {
-  net.class.out[i,] <- c(classselect[i],
-                       net(journ,
-                           classselect=classselect[i],
-                           accselect=accselect,
-                           dates="all"))
-  }
-# Add total net row
-if(total) {
-  net.class.out[nrow(net.class.out)+1,]<-c("Total",net(journal))
-  }
-return(net.class.out)
-}
-##########
-
-#work in progress
-
-########## Net table by account
-net.acc<-function(journ,
-                  classselect="all",
-                  accselect="all",
-                  dates="all",
-                  total=F) {
-# List of classes - need to do this here before passing to net()
-  if("all" %in% accselect) {
-    accselect<-unique(journ$Account)
-  }
-# Set up data frame
-net.acc.out<-data.frame(Account=character(),
-                        Net=numeric(),
-                        stringsAsFactors=FALSE)
-# Loop through accounts, calculate net, and add to data frame
-for (i in 1:length(accselect)) {
-  net.acc.out[i,] <- c(as.character(accselect[i]),
-                       net(journ,
-                           classselect=classselect,
-                           accselect=accselect[i],
-                           dates=dates))
-}
-# Sort by account name
-net.acc.out<-net.acc.out[order(net.acc.out$Account) , ]
-# Add total net row
-if(total) {
-  net.acc.out[nrow(net.acc.out)+1,]<-c("Total",net(journal))
-  }
-return(net.acc.out)
-}
-##########
-
-
-
-
-
-# See other reports in QB and Ledger
- - - - -
- - - - - - - -