cc.df<- read.csv("Consumer_complaints.csv", sep = ",")
View(cc.df)
summary(cc.df)
##     Date.received   
##  09/08/2017:  3554  
##  09/09/2017:  2709  
##  01/19/2017:  2070  
##  01/20/2017:  1633  
##  09/13/2017:  1600  
##  09/12/2017:  1229  
##  (Other)   :951347  
##                                                                          Product      
##  Mortgage                                                                    :248203  
##  Debt collection                                                             :183508  
##  Credit reporting                                                            :140433  
##  Credit card                                                                 : 89191  
##  Bank account or service                                                     : 86206  
##  Credit reporting, credit repair services, or other personal consumer reports: 84335  
##  (Other)                                                                     :132266  
##                                 Sub.product    
##                                       :235170  
##  Other mortgage                       : 86637  
##  Credit reporting                     : 82535  
##  Conventional fixed mortgage          : 70617  
##  Checking account                     : 69885  
##  Other (i.e. phone, health club, etc.): 44564  
##  (Other)                              :374734  
##                                       Issue       
##  Loan modification,collection,foreclosure:112315  
##  Incorrect information on credit report  :102687  
##  Loan servicing, payments, escrow account: 77338  
##  Cont'd attempts collect debt not owed   : 60711  
##  Incorrect information on your report    : 44724  
##  Account opening, closing, or management : 37961  
##  (Other)                                 :528406  
##                                 Sub.issue     
##                                      :487387  
##  Account status                      : 37057  
##  Debt is not mine                    : 36745  
##  Information is not mine             : 32385  
##  Not given enough info to verify debt: 21821  
##  Debt was paid                       : 20279  
##  (Other)                             :328468  
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Consumer.complaint.narrative
##                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               :719536       
##  There are many mistakes appear in my report without my understanding.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        :   177       
##  Equifax mishandled my information which has led to a breach that puts myself and millions of others at potential risk. I am extremely disappointed with how equifax has handled reporting this breach. Very little was done to notify the public for nearly a month after the breach was detected. I received no email, letter, or phone call and instead had to discover it via social media.                                                                                                                                                               :   115       
##  I am filing this complaint because Experian has ignored my request to provide me with the documents that their company has on file that was used to verify the accounts I disputed. Being that they have gone past the 30 day mark and can not verify these accounts, under Section 611 ( 5 ) ( A ) of the FCRA - they are required to " ... promptly delete all information which can not be verified '' that I have disputed. Please resolve this manner as soon as possible. Thank you.                                                                   :   103       
##  I am filing this complaint because TransUnion has ignored my request to provide me with the documents that their company has on file that was used to verify the accounts I disputed. Being that they have gone past the 30 day mark and can not verify these accounts, under Section 611 ( 5 ) ( A ) of the FCRA - they are required to " ... promptly delete all information which can not be verified '' that I have disputed. Please resolve this manner as soon as possible. Thank you.                                                                 :    50       
##  This company continues to report on my credit report after I sent them a letter telling them that this account was not mine and I have no idea what it is or who it belongs to! \n\nI asked for proof of a signed contract, I asked for a license to collect in my state, I asked for copies of all information referenced for this debt and still to date, I have not received anything but harassment from this company! \n\nTHIS IS NOT MY DEBT! \n\nI WANT THIS ACCOUNT REMOVED FROM MY CREDIT REPORT AND THIS COMPANY TO STOP CONTACTING ME IMMEDIATELY!:    49       
##  (Other)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      :244112       
##                                                                                     Company.public.response
##                                                                                                 :677327    
##  Company has responded to the consumer and the CFPB and chooses not to provide a public response:171839    
##  Company chooses not to provide a public response                                               : 52473    
##  Company believes it acted appropriately as authorized by contract or law                       : 44831    
##  Company believes the complaint is the result of a misunderstanding                             :  4209    
##  Company disputes the facts presented in the complaint                                          :  3879    
##  (Other)                                                                                        :  9584    
##                                    Company           State       
##  EQUIFAX, INC.                         : 77328   CA     :135855  
##  BANK OF AMERICA, NATIONAL ASSOCIATION : 72474   FL     : 91760  
##  Experian Information Solutions Inc.   : 65692   TX     : 77636  
##  WELLS FARGO & COMPANY                 : 60286   NY     : 64740  
##  TRANSUNION INTERMEDIATE HOLDINGS, INC.: 59574   GA     : 48130  
##  JPMORGAN CHASE & CO.                  : 49286   NJ     : 37075  
##  (Other)                               :579502   (Other):508946  
##     ZIP.code                                 Tags       
##         : 14853                                :830288  
##  300XX  :  4948   Older American               : 67281  
##  770XX  :  3797   Older American, Servicemember: 10654  
##  750XX  :  3342   Servicemember                : 55919  
##  606XX  :  3134                                         
##  331XX  :  2894                                         
##  (Other):931174                                         
##         Consumer.consent.provided.     Submitted.via   
##                      : 21020       Email      :   356  
##  Consent not provided:180282       Fax        : 13320  
##  Consent provided    :244606       Phone      : 61092  
##  Consent withdrawn   :   800       Postal mail: 57164  
##  N/A                 :504194       Referral   :147107  
##  Other               : 13240       Web        :685103  
##                                                        
##  Date.sent.to.company                  Company.response.to.consumer
##  09/08/2017:  3389    Closed with explanation        :734301       
##  09/09/2017:  2656    Closed with non-monetary relief:115228       
##  01/19/2017:  1613    Closed with monetary relief    : 59744       
##  09/13/2017:  1535    Closed without relief          : 17868       
##  01/20/2017:  1467    Closed                         : 17611       
##  09/14/2017:  1265    In progress                    :  9218       
##  (Other)   :952217    (Other)                        : 10172       
##  Timely.response. Consumer.disputed.  Complaint.ID    
##  No : 26759       N/A:195566         Min.   :      1  
##  Yes:937383       No :620198         1st Qu.: 848424  
##                   Yes:148378         Median :1645000  
##                                      Mean   :1571455  
##                                      3rd Qu.:2335337  
##                                      Max.   :2812692  
## 
mytable<- table(cc.df$Submitted.via)
addmargins(mytable)
## 
##       Email         Fax       Phone Postal mail    Referral         Web 
##         356       13320       61092       57164      147107      685103 
##         Sum 
##      964142
mytable1<- table(cc.df$Consumer.disputed.)
addmargins(mytable1)
## 
##    N/A     No    Yes    Sum 
## 195566 620198 148378 964142
mytable2<- table(cc.df$Product)
addmargins(mytable2)
## 
##                                                      Bank account or service 
##                                                                        86206 
##                                                  Checking or savings account 
##                                                                        14513 
##                                                                Consumer Loan 
##                                                                        31607 
##                                                                  Credit card 
##                                                                        89191 
##                                                  Credit card or prepaid card 
##                                                                        17485 
##                                                             Credit reporting 
##                                                                       140433 
## Credit reporting, credit repair services, or other personal consumer reports 
##                                                                        84335 
##                                                              Debt collection 
##                                                                       183508 
##                           Money transfer, virtual currency, or money service 
##                                                                         4426 
##                                                              Money transfers 
##                                                                         5354 
##                                                                     Mortgage 
##                                                                       248203 
##                                                      Other financial service 
##                                                                         1060 
##                                                                  Payday loan 
##                                                                         5546 
##                                    Payday loan, title loan, or personal loan 
##                                                                         3343 
##                                                                 Prepaid card 
##                                                                         3819 
##                                                                 Student loan 
##                                                                        40787 
##                                                        Vehicle loan or lease 
##                                                                         4308 
##                                                             Virtual currency 
##                                                                           18 
##                                                                          Sum 
##                                                                       964142
mytable3<- table(cc.df$Company.response.to.consumer)
addmargins(mytable3)
## 
##                          Closed         Closed with explanation 
##                           17611                          734301 
##     Closed with monetary relief Closed with non-monetary relief 
##                           59744                          115228 
##              Closed with relief           Closed without relief 
##                            5304                           17868 
##                     In progress               Untimely response 
##                            9218                            4868 
##                             Sum 
##                          964142
mytable4<- table(cc.df$Timely.response.)
addmargins(mytable4)
## 
##     No    Yes    Sum 
##  26759 937383 964142
mytable5<- table(cc.df$Timely.response.,cc.df$Consumer.disputed.)
addmargins(mytable5)
##      
##          N/A     No    Yes    Sum
##   No    5140  19049   2570  26759
##   Yes 190426 601149 145808 937383
##   Sum 195566 620198 148378 964142
plot(cc.df$Timely.response.,
     main="Timely response of the complain")

plot(cc.df$Product,
     main="Main products of the complain")

plot(cc.df$Consumer.consent.provided.,
     main="Whether consent was provided or not")

plot(cc.df$Submitted.via,
     main="How was the complain submitted",
     xlab="Differnt ways of submiting the complain")

plot(cc.df$Consumer.disputed.,
     main="Whether there was a dispute between the company and customer")

table6<-table(cc.df$Submitted.via, cc.df$Timely.response.)
addmargins(table6)
##              
##                   No    Yes    Sum
##   Email           10    346    356
##   Fax            406  12914  13320
##   Phone         1905  59187  61092
##   Postal mail   1074  56090  57164
##   Referral      2982 144125 147107
##   Web          20382 664721 685103
##   Sum          26759 937383 964142

```