library("arulesCBA")
## Warning: package 'arulesCBA' was built under R version 4.0.4
## Loading required package: Matrix
## Loading required package: arules
## Warning: package 'arules' was built under R version 4.0.3
## 
## Attaching package: 'arules'
## The following objects are masked from 'package:base':
## 
##     abbreviate, write
library(readr)
## Warning: package 'readr' was built under R version 4.0.3

Including Plots

You can also embed plots, for example:

## 
## -- Column specification --------------------------------------------------------
## cols(
##   age = col_double(),
##   anaemia = col_double(),
##   creatinine_phosphokinase = col_double(),
##   diabetes = col_double(),
##   ejection_fraction = col_double(),
##   high_blood_pressure = col_double(),
##   platelets = col_double(),
##   serum_creatinine = col_double(),
##   serum_sodium = col_double(),
##   sex = col_double(),
##   smoking = col_double(),
##   time = col_double(),
##   DEATH_EVENT = col_double()
## )
## tibble [299 x 13] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ age                     : num [1:299] 75 55 65 50 65 90 75 60 65 80 ...
##  $ anaemia                 : num [1:299] 0 0 0 1 1 1 1 1 0 1 ...
##  $ creatinine_phosphokinase: num [1:299] 582 7861 146 111 160 ...
##  $ diabetes                : num [1:299] 0 0 0 0 1 0 0 1 0 0 ...
##  $ ejection_fraction       : num [1:299] 20 38 20 20 20 40 15 60 65 35 ...
##  $ high_blood_pressure     : num [1:299] 1 0 0 0 0 1 0 0 0 1 ...
##  $ platelets               : num [1:299] 265000 263358 162000 210000 327000 ...
##  $ serum_creatinine        : num [1:299] 1.9 1.1 1.3 1.9 2.7 2.1 1.2 1.1 1.5 9.4 ...
##  $ serum_sodium            : num [1:299] 130 136 129 137 116 132 137 131 138 133 ...
##  $ sex                     : num [1:299] 1 1 1 1 0 1 1 1 0 1 ...
##  $ smoking                 : num [1:299] 0 0 1 0 0 1 0 1 0 1 ...
##  $ time                    : num [1:299] 4 6 7 7 8 8 10 10 10 10 ...
##  $ DEATH_EVENT             : num [1:299] 1 1 1 1 1 1 1 1 1 1 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   age = col_double(),
##   ..   anaemia = col_double(),
##   ..   creatinine_phosphokinase = col_double(),
##   ..   diabetes = col_double(),
##   ..   ejection_fraction = col_double(),
##   ..   high_blood_pressure = col_double(),
##   ..   platelets = col_double(),
##   ..   serum_creatinine = col_double(),
##   ..   serum_sodium = col_double(),
##   ..   sex = col_double(),
##   ..   smoking = col_double(),
##   ..   time = col_double(),
##   ..   DEATH_EVENT = col_double()
##   .. )
##       age           anaemia       creatinine_phosphokinase    diabetes     
##  Min.   :40.00   Min.   :0.0000   Min.   :  23.0           Min.   :0.0000  
##  1st Qu.:51.00   1st Qu.:0.0000   1st Qu.: 116.5           1st Qu.:0.0000  
##  Median :60.00   Median :0.0000   Median : 250.0           Median :0.0000  
##  Mean   :60.83   Mean   :0.4314   Mean   : 581.8           Mean   :0.4181  
##  3rd Qu.:70.00   3rd Qu.:1.0000   3rd Qu.: 582.0           3rd Qu.:1.0000  
##  Max.   :95.00   Max.   :1.0000   Max.   :7861.0           Max.   :1.0000  
##  ejection_fraction high_blood_pressure   platelets      serum_creatinine
##  Min.   :14.00     Min.   :0.0000      Min.   : 25100   Min.   :0.500   
##  1st Qu.:30.00     1st Qu.:0.0000      1st Qu.:212500   1st Qu.:0.900   
##  Median :38.00     Median :0.0000      Median :262000   Median :1.100   
##  Mean   :38.08     Mean   :0.3512      Mean   :263358   Mean   :1.394   
##  3rd Qu.:45.00     3rd Qu.:1.0000      3rd Qu.:303500   3rd Qu.:1.400   
##  Max.   :80.00     Max.   :1.0000      Max.   :850000   Max.   :9.400   
##   serum_sodium        sex            smoking            time      
##  Min.   :113.0   Min.   :0.0000   Min.   :0.0000   Min.   :  4.0  
##  1st Qu.:134.0   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.: 73.0  
##  Median :137.0   Median :1.0000   Median :0.0000   Median :115.0  
##  Mean   :136.6   Mean   :0.6488   Mean   :0.3211   Mean   :130.3  
##  3rd Qu.:140.0   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:203.0  
##  Max.   :148.0   Max.   :1.0000   Max.   :1.0000   Max.   :285.0  
##   DEATH_EVENT    
##  Min.   :0.0000  
##  1st Qu.:0.0000  
##  Median :0.0000  
##  Mean   :0.3211  
##  3rd Qu.:1.0000  
##  Max.   :1.0000
## [1] 299  13
##  [1] "age"                      "anaemia"                 
##  [3] "creatinine_phosphokinase" "diabetes"                
##  [5] "ejection_fraction"        "high_blood_pressure"     
##  [7] "platelets"                "serum_creatinine"        
##  [9] "serum_sodium"             "sex"                     
## [11] "smoking"                  "time"                    
## [13] "DEATH_EVENT"
## Warning: package 'ggparty' was built under R version 4.0.4
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.0.3
## Loading required package: partykit
## Warning: package 'partykit' was built under R version 4.0.3
## Loading required package: grid
## Loading required package: libcoin
## Warning: package 'libcoin' was built under R version 4.0.3
## Loading required package: mvtnorm
## Warning: package 'mvtnorm' was built under R version 4.0.3

## CBA Classifier Object
## Class: 
## Default Class: NA
## Number of rules: 11
## Classification method: first  
## Description: CBA algorithm (Liu et al., 1998)
##      lhs                                rhs               support confidence  coverage     lift count size coveredTransactions totalErrors
## [1]  {age=[-Inf,71),                                                                                                                      
##       ejection_fraction=[27.5, Inf],                                                                                                      
##       serum_sodium=[136, Inf],                                                                                                            
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.3946488  0.9593496 0.4113712 1.413032   118    5                 123          90
## [2]  {age=[-Inf,71),                                                                                                                      
##       ejection_fraction=[27.5, Inf],                                                                                                      
##       serum_creatinine=[-Inf,1.81),                                                                                                       
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.4916388  0.9545455 0.5150502 1.405956   147    5                  35          61
## [3]  {ejection_fraction=[27.5, Inf],                                                                                                      
##       serum_creatinine=[-Inf,1.81),                                                                                                       
##       serum_sodium=[136, Inf],                                                                                                            
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.4214047  0.9545455 0.4414716 1.405956   126    5                  13          52
## [4]  {ejection_fraction=[27.5, Inf],                                                                                                      
##       serum_sodium=[136, Inf],                                                                                                            
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.4347826  0.9489051 0.4581940 1.397648   130    4                   1          51
## [5]  {age=[-Inf,71),                                                                                                                      
##       ejection_fraction=[27.5, Inf],                                                                                                      
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.5083612  0.9440994 0.5384615 1.390570   152    4                   3          50
## [6]  {age=[-Inf,71),                                                                                                                      
##       serum_creatinine=[-Inf,1.81),                                                                                                       
##       serum_sodium=[136, Inf],                                                                                                            
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.4147157  0.9323308 0.4448161 1.373236   124    5                  14          46
## [7]  {ejection_fraction=[27.5, Inf],                                                                                                      
##       serum_creatinine=[-Inf,1.81),                                                                                                       
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.5451505  0.9314286 0.5852843 1.371907   163    4                   8          44
## [8]  {age=[-Inf,71),                                                                                                                      
##       serum_sodium=[136, Inf],                                                                                                            
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.4280936  0.9208633 0.4648829 1.356345   128    4                   2          44
## [9]  {serum_creatinine=[-Inf,1.81),                                                                                                       
##       serum_sodium=[136, Inf],                                                                                                            
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.4548495  0.9189189 0.4949833 1.353482   136    4                   2          44
## [10] {age=[-Inf,71),                                                                                                                      
##       serum_creatinine=[-Inf,1.81),                                                                                                       
##       time=[73.5, Inf]}              => {DEATH_EVENT=0} 0.5384615  0.9147727 0.5886288 1.347375   161    4                   8          42
## [11] {}                              => {DEATH_EVENT=1} 0.3210702  0.3210702        NA 1.000000   299    1                  90          42