Poop Sheet

Credit

> Credit = read.csv("Credit.csv", header = T, na.strings = "?", stringsAsFactors = T)
> head(Credit)
   Income Limit Rating Cards Age Education Own Student Married Region Balance
1  14.891  3606    283     2  34        11  No      No     Yes  South     333
2 106.025  6645    483     3  82        15 Yes     Yes     Yes   West     903
3 104.593  7075    514     4  71        11  No      No      No   West     580
4 148.924  9504    681     3  36        11 Yes      No      No   West     964
5  55.882  4897    357     2  68        16  No      No     Yes  South     331
6  80.180  8047    569     4  77        10  No      No      No  South    1151

To get the correlation of “Own”, “Student”, “Married”, and “Region”, these need to be converted to dummy columns with numbers.

Credit = read.csv("Credit.csv", header = T, na.strings = "?", stringsAsFactors = T)
Credit$Own <- as.integer(Credit$Own == "Yes")
Credit$Student <- as.integer(Credit$Student == "Yes")
Credit$Married <- as.integer(Credit$Married == "Yes")
Credit$Region <- which(c("North", "East", "South", "West") == Credit$Region)
cor(Credit)
               Income        Limit       Rating        Cards          Age
Income     1.00000000  0.792088341  0.791377625 -0.018272610  0.175338403
Limit      0.79208834  1.000000000  0.996879737  0.010231333  0.100887922
Rating     0.79137763  0.996879737  1.000000000  0.053239030  0.103164996
Cards     -0.01827261  0.010231333  0.053239030  1.000000000  0.042948288
Age        0.17533840  0.100887922  0.103164996  0.042948288  1.000000000
Education -0.02769198 -0.023548534 -0.030135627 -0.051084217  0.003619285
Own       -0.01073751  0.009396678  0.008884590 -0.022658021  0.004015496
Student    0.01963214 -0.006015094 -0.002027646 -0.026164127 -0.029844426
Married    0.03565236  0.031154829  0.036750773 -0.009695060 -0.073135503
Region    -0.02066518 -0.032402812 -0.032141719  0.004715417 -0.023056881
Balance    0.46365646  0.861697267  0.863625161  0.086456347  0.001835119
             Education          Own      Student     Married       Region
Income    -0.027691982 -0.010737514  0.019632138  0.03565236 -0.020665175
Limit     -0.023548534  0.009396678 -0.006015094  0.03115483 -0.032402812
Rating    -0.030135627  0.008884590 -0.002027646  0.03675077 -0.032141719
Cards     -0.051084217 -0.022658021 -0.026164127 -0.00969506  0.004715417
Age        0.003619285  0.004015496 -0.029844426 -0.07313550 -0.023056881
Education  1.000000000 -0.005049071  0.072085400  0.04891059 -0.010934927
Own       -0.005049071  1.000000000  0.055033718  0.01245171 -0.014388917
Student    0.072085400  0.055033718  1.000000000 -0.07697370 -0.074657367
Married    0.048910587  0.012451711 -0.076973701  1.00000000 -0.019947897
Region    -0.010934927 -0.014388917 -0.074657367 -0.01994790  1.000000000
Balance   -0.008061576  0.021474007  0.259017547 -0.00567349 -0.037271955
               Balance
Income     0.463656457
Limit      0.861697267
Rating     0.863625161
Cards      0.086456347
Age        0.001835119
Education -0.008061576
Own        0.021474007
Student    0.259017547
Married   -0.005673490
Region    -0.037271955
Balance    1.000000000