Created
October 20, 2017 10:33
-
-
Save pbdanny/94fb858549453f16352069b09dd299b3 to your computer and use it in GitHub Desktop.
RL Credit Limit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(RODBC) | |
| con <- odbcConnectAccess2007("D:/Backup/OSS & TS - Performance/OSSDatabase.accdb") | |
| # sqlTables(con) | |
| topQuery <- "select top 10 * | |
| from qry_RL_Portfolio_M | |
| where Month between '201701' and '201709' | |
| and Result = 'A';" | |
| topDf <- sqlQuery(con, topQuery, as.is = T) | |
| query <- "select Channel_Sub, TL_Type, Result, Result_Description, | |
| Credit_Limit, FDD, Monthly_Salary, AGE, Month | |
| from qry_RL_Portfolio_M | |
| where Month between '201701' and '201709';" | |
| df <- sqlQuery(con, query, as.is = T) | |
| odbcCloseAll() | |
| table(df$Channel_Sub) | |
| df$limitRatio <- df$Credit_Limit/df$Monthly_Salary | |
| setwd("D:/Backup/OSS & TS - Performance/2017/Tracking OSS Portfolio/Sep 17") | |
| df <- readRDS(file = "RL CreditLimit.RDS") | |
| direct <- subset(df, Channel_Sub == "Direct") | |
| direct$JanAug <- direct$Month != "201709" | |
| library(ggplot2) | |
| ggplot(data = subset(direct, Month %in% c("201701", "201703", "201709")), | |
| aes(x = log10(Monthly_Salary), col = as.factor(Month))) + | |
| geom_freqpoly() + ggtitle(label = "Direct") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment