Skip to main content

Section 9.3 Load and Preview Data

First, we need to load the ISLR2 ([D.1.11]) package and then we will create our cc_data dataset using the Default dataset, which inside the package.
library(ISLR2)
library(tidyverse)

cc_data <- Default # this data comes from the ISLR2 package

library(skimr)

skim(cc_data)
── Data Summary ────────────────────────
                           Values 
Name                       cc_data
Number of rows             10000  
Number of columns          4      
_______________________           
Column type frequency:            
  factor                   2      
  numeric                  2      
________________________          
Group variables            None   

── Variable type: factor ───────────────────────────────────────────────────────
  skim_variable n_missing complete_rate ordered n_unique top_counts         
1 default               0             1 FALSE          2 No: 9667, Yes: 333 
2 student               0             1 FALSE          2 No: 7056, Yes: 2944

── Variable type: numeric ──────────────────────────────────────────────────────
  skim_variable n_missing complete_rate     mean        sd     p0     p25        p50
1 balance               0             1   835.37 	  483.71	 0.00	  481.73	  823.64	
2 income                0             1 33516.98	13336.64 771.97	21340.46	34552.64
       p75      p100  hist 
1  1166.31	 2654.32  ▆▇▅▁▁
2 43807.73	73554.23	▂▇▇▅▁
Our data contains 10,000 rows of data, each relating to a particular person. Two variables are factors, the other two are numeric. The variables are:
  1. default: A factor with levels No and Yes indicating whether the customer defaulted on their debt
  2. student: A factor with levels No and Yes indicating whether the customer is a student
  3. balance: The average balance that the customer has remaining on their credit card after making their monthly payment
  4. income: Income of customer

Regarding the ISLR2 package:.

The definitions of the columns come directly from the description found in the package
We have our most crucial data point - if the person did or did not default on their credit card payments. Soon, we will be using the other data points to see if we can predict if someone will or will not default on their payments.
First, let’s do a little digging to find out more about our data.