Replicate a case study of marketing analytics: https://www.linkedin.com/learning/the-data-science-of-marketing/cluster-analysis-with-r?u=2232593

Q1 Import data

library(readr)
clusterdata <- read_csv("/cloud/project/cluster-r.csv")
clusterdata
## # A tibble: 300 x 5
##    Email                         `Behavior-3` `Brand-Preferenc…   CTA `Demo-Age`
##    <chr>                                <dbl>             <dbl> <dbl>      <dbl>
##  1 nisl@adipiscingelit.org                 16                12     9         48
##  2 dui.Fusce.diam@non.edu                  25                 8     6         41
##  3 nisl.Maecenas@vitaeorciPhase…           23                11     4         50
##  4 justo.nec@Aenean.edu                     4                12    11         34
##  5 neque.Morbi.quis@Aeneanmassa…           29                10     2         59
##  6 elit@erat.org                           16                 6    13         57
##  7 non.arcu.Vivamus@montesnasce…           26                 7     7         58
##  8 Proin.sed@sit.co.uk                     13                 9     4         64
##  9 auctor@odioEtiam.ca                     23                10    12         58
## 10 Mauris.non.dui@nisia.co.uk              11                 1    11         23
## # … with 290 more rows

Q2 Review data

head(clusterdata, 8)
## # A tibble: 8 x 5
##   Email                          `Behavior-3` `Brand-Preferenc…   CTA `Demo-Age`
##   <chr>                                 <dbl>             <dbl> <dbl>      <dbl>
## 1 nisl@adipiscingelit.org                  16                12     9         48
## 2 dui.Fusce.diam@non.edu                   25                 8     6         41
## 3 nisl.Maecenas@vitaeorciPhasel…           23                11     4         50
## 4 justo.nec@Aenean.edu                      4                12    11         34
## 5 neque.Morbi.quis@AeneanmassaI…           29                10     2         59
## 6 elit@erat.org                            16                 6    13         57
## 7 non.arcu.Vivamus@montesnascet…           26                 7     7         58
## 8 Proin.sed@sit.co.uk                      13                 9     4         64
tail(clusterdata, 8)
## # A tibble: 8 x 5
##   Email                          `Behavior-3` `Brand-Preferenc…   CTA `Demo-Age`
##   <chr>                                 <dbl>             <dbl> <dbl>      <dbl>
## 1 Duis.ac.arcu@congue.ca                    7                12    13         40
## 2 est.congue.a@orciPhasellus.ca            29                 7    17         44
## 3 consectetuer.ipsum.nunc@males…           17                12     4         64
## 4 mollis@NullafacilisiSed.org              27                11     4         33
## 5 aliquet.metus@iaculislacusped…           21                11    10         50
## 6 ac.ipsum@sit.co.uk                        8                 7     3         46
## 7 Fusce@sagittisaugue.com                  18                 2     4         19
## 8 magna.Lorem.ipsum@nibhPhasell…           17                 3     6         66

Q3 Standardize data

clusterdatastandardized <- scale(clusterdata[-1])
clusterdatastandardized
##         Behavior-3 Brand-Preference         CTA    Demo-Age
##   [1,] -0.06450461        1.5764994 -0.06016808  0.45191951
##   [2,]  1.01724970        0.4409656 -0.65523704  0.02093360
##   [3,]  0.77685986        1.2926159 -1.05194967  0.57505834
##   [4,] -1.50684369        1.5764994  0.33654455 -0.41005230
##   [5,]  1.49802940        1.0087325 -1.44866231  1.12918307
##   [6,] -0.06450461       -0.1268013  0.73325719  1.00604424
##   [7,]  1.13744463        0.1570822 -0.45688072  1.06761366
##   [8,] -0.42508938        0.7248490 -1.05194967  1.43703015
##   [9,]  0.77685986        1.0087325  0.53490087  1.06761366
##  [10,] -0.66547923       -1.5462185  0.33654455 -1.08731587
##  [11,] -1.02606400       -0.4106847 -0.25852440 -0.28691347
##  [12,]  1.37783448        1.2926159 -0.85359335 -0.10220523
##  [13,] -0.06450461        1.5764994  0.33654455  1.43703015
##  [14,]  1.01724970        0.7248490 -0.45688072 -1.64144060
##  [15,]  0.17588524       -0.1268013 -0.06016808 -0.41005230
##  [16,]  0.65666493        0.1570822  1.32832614  1.12918307
##  [17,] -1.38664877        0.4409656  1.32832614 -0.90260762
##  [18,] -0.78567415        0.7248490  1.12996982  0.02093360
##  [19,]  0.53647001       -1.5462185  1.32832614 -0.90260762
##  [20,] -1.50684369       -0.6945681 -0.45688072 -0.10220523
##  [21,]  1.61822432       -0.4106847  1.52668246 -0.96417704
##  [22,]  1.01724970        1.5764994 -0.85359335 -1.70301002
##  [23,]  0.17588524       -0.9784516 -0.85359335  1.43703015
##  [24,]  0.77685986       -0.9784516 -1.64701862  0.57505834
##  [25,]  0.65666493       -0.1268013 -0.25852440  0.39035009
##  [26,] -1.74723354        1.0087325 -1.05194967  0.45191951
##  [27,]  1.49802940       -1.2623350 -1.64701862  0.69819717
##  [28,]  0.65666493        1.2926159 -0.85359335 -0.47162172
##  [29,] -1.38664877       -1.2623350 -1.44866231 -1.21045470
##  [30,]  0.53647001        0.1570822 -1.44866231 -0.16377464
##  [31,] -0.42508938       -0.6945681  0.53490087 -1.21045470
##  [32,] -0.42508938       -1.5462185 -1.25030599 -0.65632996
##  [33,]  1.61822432        1.0087325 -1.05194967  1.31389132
##  [34,]  1.61822432       -0.6945681 -0.85359335 -1.57987119
##  [35,] -0.30489446       -1.5462185 -0.25852440  1.56016898
##  [36,] -0.18469953       -0.6945681  0.73325719 -1.39516294
##  [37,]  1.61822432        0.7248490  0.93161350  1.06761366
##  [38,] -0.06450461       -1.2623350 -0.25852440  1.06761366
##  [39,] -0.54528430       -1.2623350  1.72503878 -0.84103821
##  [40,]  1.01724970       -0.1268013  0.53490087  0.45191951
##  [41,]  0.05569031        0.4409656 -0.45688072 -0.41005230
##  [42,]  0.53647001        1.5764994 -1.25030599 -0.22534406
##  [43,] -1.62703862        1.2926159 -0.06016808 -1.08731587
##  [44,] -1.02606400        1.0087325  0.93161350 -0.34848289
##  [45,] -0.06450461        1.5764994  1.12996982 -1.45673236
##  [46,] -1.74723354       -0.9784516 -0.65523704  1.62173839
##  [47,]  0.77685986       -1.2623350 -0.45688072 -0.84103821
##  [48,]  1.37783448       -0.4106847 -0.06016808  0.94447483
##  [49,] -0.42508938       -1.2623350  1.32832614  0.75976658
##  [50,] -1.38664877       -0.1268013 -1.44866231  1.31389132
##  [51,] -0.66547923       -0.6945681  0.53490087  0.08250302
##  [52,] -0.18469953       -1.2623350 -1.05194967  1.06761366
##  [53,] -0.54528430        1.5764994  0.93161350  0.14407243
##  [54,]  0.29608016       -0.4106847 -0.85359335 -0.22534406
##  [55,]  1.01724970        0.4409656 -1.64701862 -0.90260762
##  [56,]  1.37783448        0.4409656 -0.65523704 -0.77946879
##  [57,] -0.30489446        0.7248490 -1.64701862  0.39035009
##  [58,] -0.78567415       -0.6945681  0.93161350 -0.77946879
##  [59,]  0.89705478        0.7248490  1.72503878  0.82133600
##  [60,]  1.61822432        0.1570822  0.73325719  0.32878068
##  [61,] -0.78567415        1.2926159  0.93161350  1.12918307
##  [62,]  1.01724970       -0.6945681 -0.85359335 -0.71789938
##  [63,]  0.29608016       -1.2623350 -1.25030599 -0.16377464
##  [64,] -0.18469953        1.5764994  1.72503878 -1.27202411
##  [65,] -1.14625892        0.7248490 -1.05194967  1.31389132
##  [66,] -1.50684369        0.7248490  0.73325719 -0.22534406
##  [67,]  0.41627509       -0.4106847 -1.64701862 -0.96417704
##  [68,] -1.26645385       -1.5462185 -0.06016808 -1.14888528
##  [69,]  1.01724970        0.7248490 -0.65523704 -1.64144060
##  [70,] -1.38664877       -0.4106847 -1.44866231 -0.34848289
##  [71,]  0.53647001       -1.5462185  0.73325719  1.37546073
##  [72,]  0.29608016        0.4409656  0.93161350 -1.27202411
##  [73,]  0.29608016       -0.6945681  0.73325719  0.82133600
##  [74,] -0.42508938        0.4409656  1.32832614  0.57505834
##  [75,] -0.30489446        1.5764994 -1.25030599  0.51348892
##  [76,] -0.42508938        1.0087325 -0.06016808 -0.53319113
##  [77,] -1.50684369       -0.1268013  1.12996982  0.14407243
##  [78,]  1.01724970        1.0087325 -0.85359335 -0.28691347
##  [79,]  1.61822432       -0.6945681  1.72503878 -0.10220523
##  [80,]  1.61822432       -0.9784516  1.12996982  0.39035009
##  [81,] -0.66547923        0.4409656 -0.25852440  0.94447483
##  [82,] -1.38664877        1.0087325  1.72503878 -0.34848289
##  [83,] -1.62703862        1.2926159 -0.85359335 -0.28691347
##  [84,]  0.05569031       -0.1268013  0.93161350 -0.53319113
##  [85,]  1.49802940       -0.6945681  0.33654455  0.45191951
##  [86,] -0.06450461        1.5764994 -1.64701862  1.06761366
##  [87,]  1.25763955       -0.9784516 -0.45688072 -0.59476055
##  [88,]  1.01724970       -0.9784516 -0.65523704  0.08250302
##  [89,]  0.05569031        1.5764994  0.33654455  0.08250302
##  [90,] -1.14625892       -0.9784516 -0.06016808  1.19075249
##  [91,]  1.13744463        1.5764994 -1.05194967  1.25232190
##  [92,] -1.02606400       -0.9784516  0.93161350  1.12918307
##  [93,]  1.13744463       -1.5462185 -1.25030599 -1.70301002
##  [94,] -0.42508938       -1.2623350 -1.05194967  0.94447483
##  [95,] -1.26645385        0.1570822  0.53490087  1.25232190
##  [96,]  0.89705478        1.0087325 -0.85359335  1.25232190
##  [97,] -0.42508938       -0.4106847  1.12996982  1.49859956
##  [98,] -1.50684369       -1.5462185 -1.05194967  0.75976658
##  [99,] -0.30489446       -0.1268013  1.52668246 -0.96417704
## [100,] -0.18469953        1.2926159  1.72503878 -0.59476055
## [101,]  0.29608016       -1.2623350 -1.25030599 -1.33359353
## [102,] -1.38664877       -1.5462185 -0.85359335 -1.51830177
## [103,] -0.90586907       -0.4106847  1.52668246 -0.90260762
## [104,] -0.90586907        1.2926159 -0.85359335  1.19075249
## [105,]  0.53647001       -0.9784516  1.12996982  0.88290541
## [106,]  0.53647001       -1.5462185 -0.65523704  1.68330781
## [107,] -0.78567415        1.5764994 -0.06016808  0.63662775
## [108,]  0.65666493        0.4409656 -1.64701862 -0.90260762
## [109,] -0.78567415       -1.2623350 -1.25030599  1.49859956
## [110,] -0.06450461       -0.6945681 -0.65523704 -0.96417704
## [111,]  0.41627509       -0.1268013 -0.85359335  1.12918307
## [112,] -0.78567415        0.4409656 -0.06016808  0.26721126
## [113,] -1.74723354       -1.2623350  0.33654455 -1.45673236
## [114,]  1.61822432       -0.4106847  0.13818823  0.75976658
## [115,] -1.38664877       -0.1268013 -0.25852440  1.25232190
## [116,] -1.26645385       -0.1268013  1.72503878 -0.90260762
## [117,] -1.02606400        0.4409656 -1.64701862  0.02093360
## [118,] -0.54528430        1.5764994  1.32832614 -0.04063581
## [119,]  0.05569031        1.5764994  0.33654455  0.02093360
## [120,] -0.66547923       -0.4106847 -1.64701862 -1.08731587
## [121,] -0.18469953        1.2926159  0.53490087  1.68330781
## [122,] -1.02606400        0.4409656  1.32832614 -0.90260762
## [123,] -1.86742846        0.4409656  1.52668246 -0.22534406
## [124,]  0.77685986        0.7248490  1.32832614 -0.04063581
## [125,]  1.25763955       -1.2623350  0.73325719 -0.53319113
## [126,]  1.13744463       -0.4106847  1.12996982 -1.14888528
## [127,] -0.42508938       -1.5462185  0.13818823 -1.08731587
## [128,] -0.90586907        0.7248490 -0.65523704 -0.34848289
## [129,]  1.13744463        1.2926159  0.33654455  0.32878068
## [130,]  0.89705478       -0.1268013  1.12996982  0.39035009
## [131,]  0.29608016        0.4409656 -0.85359335  1.62173839
## [132,] -0.54528430        0.1570822  0.13818823  1.37546073
## [133,] -0.90586907       -0.9784516 -0.25852440  0.75976658
## [134,]  1.37783448       -1.5462185 -1.25030599  0.88290541
## [135,]  1.25763955        0.7248490  0.13818823 -0.65632996
## [136,]  0.29608016       -0.9784516  1.32832614  0.88290541
## [137,]  0.41627509       -0.1268013  1.72503878  0.82133600
## [138,]  1.01724970       -1.5462185 -0.85359335 -1.08731587
## [139,]  0.65666493       -0.4106847  0.33654455  1.06761366
## [140,]  1.25763955        0.1570822  1.12996982  1.62173839
## [141,]  0.53647001       -1.2623350 -0.06016808 -1.21045470
## [142,]  0.17588524        1.5764994  1.52668246 -1.45673236
## [143,] -1.50684369        0.7248490  0.53490087 -1.21045470
## [144,] -0.06450461        1.2926159  0.93161350  0.08250302
## [145,] -0.78567415        1.5764994 -0.25852440 -0.59476055
## [146,] -0.42508938       -0.1268013  1.72503878 -1.21045470
## [147,] -0.66547923       -0.1268013  1.52668246 -1.45673236
## [148,] -1.86742846        1.2926159  1.32832614  1.31389132
## [149,] -0.42508938        1.2926159  0.53490087 -1.02574645
## [150,] -1.02606400       -1.2623350  0.53490087  0.39035009
## [151,]  1.61822432        1.2926159  0.73325719 -0.22534406
## [152,]  0.65666493        1.5764994  0.13818823 -1.27202411
## [153,] -0.18469953       -0.1268013  0.33654455 -0.65632996
## [154,]  0.41627509        0.4409656 -0.45688072 -0.34848289
## [155,]  1.13744463        1.0087325 -1.05194967 -0.28691347
## [156,] -0.18469953        0.4409656 -1.05194967 -1.14888528
## [157,]  1.01724970       -1.5462185 -0.65523704  1.56016898
## [158,] -1.86742846       -0.1268013 -0.65523704 -0.90260762
## [159,] -0.54528430        0.1570822  0.73325719  0.26721126
## [160,]  0.17588524       -1.5462185 -1.25030599  0.32878068
## [161,] -1.62703862        1.5764994 -1.64701862 -0.84103821
## [162,] -1.62703862        0.4409656 -0.25852440  1.19075249
## [163,] -1.50684369        0.1570822 -1.44866231 -0.59476055
## [164,] -1.50684369       -0.9784516  0.33654455 -0.04063581
## [165,] -0.90586907       -0.6945681  0.73325719 -1.64144060
## [166,] -1.38664877        1.5764994 -0.65523704 -1.33359353
## [167,] -0.90586907       -0.6945681  0.93161350  0.45191951
## [168,] -1.62703862       -0.4106847 -1.64701862 -1.14888528
## [169,]  0.77685986       -0.6945681  0.73325719 -1.57987119
## [170,]  0.29608016        0.7248490 -1.64701862 -0.59476055
## [171,]  1.13744463       -0.4106847  0.73325719 -0.41005230
## [172,] -0.42508938       -1.2623350  1.12996982 -1.39516294
## [173,] -0.54528430       -0.4106847 -1.25030599  1.31389132
## [174,]  1.01724970       -1.5462185 -0.25852440 -1.64144060
## [175,] -0.78567415       -1.2623350  0.93161350  1.56016898
## [176,] -1.50684369       -0.9784516 -0.25852440 -1.21045470
## [177,]  1.49802940       -0.6945681  1.32832614  0.32878068
## [178,]  0.29608016        0.1570822 -0.45688072  0.69819717
## [179,] -0.66547923        0.1570822  0.93161350  1.12918307
## [180,] -0.78567415        0.4409656 -0.45688072 -0.90260762
## [181,]  1.13744463       -0.4106847 -1.25030599  1.06761366
## [182,] -0.66547923        0.4409656 -1.25030599 -0.53319113
## [183,] -1.14625892       -0.1268013  0.53490087 -0.28691347
## [184,]  0.29608016       -0.9784516 -1.44866231  0.45191951
## [185,]  0.41627509       -1.5462185 -0.85359335 -0.65632996
## [186,]  0.05569031        0.4409656  1.72503878 -0.28691347
## [187,]  1.13744463       -0.9784516  0.33654455 -0.96417704
## [188,] -0.06450461       -1.2623350  0.33654455  0.88290541
## [189,]  1.13744463        1.2926159  0.93161350 -1.21045470
## [190,] -1.14625892       -0.1268013 -0.06016808 -1.39516294
## [191,] -1.74723354       -1.5462185  0.73325719 -0.04063581
## [192,] -1.38664877       -0.9784516  1.12996982 -1.51830177
## [193,]  1.61822432       -0.1268013  0.33654455  1.19075249
## [194,] -0.06450461       -0.6945681  0.33654455  1.31389132
## [195,]  0.17588524       -0.6945681 -0.06016808  1.19075249
## [196,] -1.62703862        1.0087325  1.12996982 -1.33359353
## [197,]  1.49802940        0.7248490 -0.85359335  0.02093360
## [198,]  1.61822432        0.1570822  0.73325719 -1.27202411
## [199,]  0.53647001       -0.4106847 -1.05194967  1.25232190
## [200,] -0.18469953       -0.4106847 -0.85359335 -0.59476055
## [201,] -1.14625892        1.0087325  0.73325719 -0.22534406
## [202,]  0.53647001        0.1570822 -1.05194967 -0.28691347
## [203,]  0.41627509        1.5764994 -1.64701862  0.94447483
## [204,]  1.37783448        0.7248490  1.52668246 -1.02574645
## [205,] -0.18469953        1.0087325 -0.06016808 -0.10220523
## [206,]  1.13744463        1.5764994  1.12996982  0.39035009
## [207,]  1.37783448       -0.6945681 -1.64701862  0.14407243
## [208,] -0.78567415       -0.4106847  0.53490087  1.19075249
## [209,]  0.29608016        0.4409656 -0.25852440  0.39035009
## [210,]  0.17588524       -0.9784516 -0.45688072 -1.64144060
## [211,]  1.61822432        1.2926159 -0.25852440 -1.33359353
## [212,] -0.18469953       -1.2623350 -0.85359335  0.02093360
## [213,]  0.17588524        0.4409656  1.32832614 -1.70301002
## [214,]  0.89705478        1.5764994 -0.45688072 -0.34848289
## [215,]  1.37783448        0.1570822  0.93161350  0.82133600
## [216,] -0.66547923       -1.5462185  0.13818823  0.14407243
## [217,] -1.38664877        1.2926159  0.13818823 -1.02574645
## [218,]  1.25763955        0.1570822 -0.65523704 -0.53319113
## [219,]  0.17588524       -0.1268013  0.93161350 -1.39516294
## [220,]  0.77685986       -1.2623350 -1.44866231  0.88290541
## [221,]  1.13744463        1.2926159 -0.06016808  1.19075249
## [222,] -0.90586907       -0.9784516 -1.05194967  1.68330781
## [223,] -1.26645385       -1.5462185 -1.05194967 -0.10220523
## [224,]  0.53647001       -0.1268013 -0.45688072  0.14407243
## [225,] -0.42508938       -0.1268013 -1.44866231 -0.41005230
## [226,]  0.17588524       -0.4106847 -0.65523704 -1.02574645
## [227,] -0.06450461        1.0087325 -1.25030599 -1.51830177
## [228,] -0.06450461        0.1570822 -0.25852440 -0.96417704
## [229,]  1.49802940        1.0087325 -1.44866231 -0.22534406
## [230,] -1.50684369        0.7248490  0.33654455  0.39035009
## [231,] -1.26645385       -0.1268013  0.93161350  1.31389132
## [232,] -1.14625892        0.7248490  0.33654455 -1.45673236
## [233,] -1.14625892       -0.4106847 -0.06016808  0.75976658
## [234,] -0.42508938        1.2926159  1.72503878 -1.51830177
## [235,] -0.78567415       -1.5462185  0.53490087  1.68330781
## [236,] -0.66547923       -1.2623350  1.12996982  0.75976658
## [237,] -1.02606400       -0.1268013  0.93161350  0.26721126
## [238,]  1.37783448       -1.2623350  1.32832614 -0.65632996
## [239,]  1.25763955        0.7248490  1.52668246  1.31389132
## [240,]  0.17588524       -1.2623350  0.13818823  1.49859956
## [241,] -0.18469953       -0.1268013  0.93161350  0.08250302
## [242,]  0.53647001        0.4409656  1.12996982  1.43703015
## [243,] -0.90586907       -0.9784516 -0.25852440 -0.77946879
## [244,]  1.13744463        0.1570822 -1.44866231  1.37546073
## [245,]  0.89705478       -0.4106847  1.52668246  0.75976658
## [246,] -0.90586907       -1.5462185 -1.25030599  1.06761366
## [247,]  1.61822432        1.2926159 -1.05194967 -0.28691347
## [248,] -0.54528430        0.4409656 -1.25030599 -1.21045470
## [249,] -0.30489446        0.7248490 -0.65523704 -1.39516294
## [250,] -0.42508938        1.5764994  0.93161350  1.00604424
## [251,]  0.05569031       -1.5462185 -0.85359335 -0.16377464
## [252,]  1.37783448        0.1570822  1.52668246  0.82133600
## [253,]  1.49802940       -1.5462185  0.53490087  0.82133600
## [254,] -1.86742846        0.4409656 -0.85359335  1.37546073
## [255,]  1.25763955       -1.2623350 -1.25030599  1.37546073
## [256,] -1.62703862       -1.5462185  0.93161350 -1.27202411
## [257,]  1.13744463       -0.6945681 -1.25030599  0.57505834
## [258,] -1.38664877        0.1570822 -0.65523704  0.08250302
## [259,] -0.54528430        1.2926159  1.32832614 -0.04063581
## [260,]  0.41627509       -0.1268013  0.93161350  0.82133600
## [261,]  1.37783448       -1.2623350 -0.25852440 -0.59476055
## [262,]  1.01724970        0.4409656 -0.25852440  0.39035009
## [263,]  0.65666493       -1.5462185  1.52668246  1.12918307
## [264,] -0.06450461        1.2926159 -1.05194967 -0.47162172
## [265,]  1.37783448       -0.4106847  0.13818823  0.02093360
## [266,]  1.01724970        1.0087325  0.33654455  1.43703015
## [267,]  0.41627509        1.0087325  1.52668246 -1.45673236
## [268,]  0.89705478        1.2926159  1.32832614 -1.27202411
## [269,]  1.25763955       -0.6945681 -0.65523704 -1.02574645
## [270,]  0.53647001       -0.1268013 -1.44866231 -0.59476055
## [271,] -0.06450461       -0.6945681 -0.45688072 -1.64144060
## [272,]  1.13744463        1.0087325  1.32832614  0.88290541
## [273,] -1.02606400        0.7248490  0.73325719  1.68330781
## [274,]  0.53647001       -0.9784516 -0.25852440 -0.28691347
## [275,] -1.02606400       -0.1268013  1.12996982  0.45191951
## [276,] -1.74723354       -0.1268013  1.32832614 -1.70301002
## [277,] -0.54528430        1.2926159  0.33654455 -0.28691347
## [278,]  0.29608016       -0.1268013 -0.45688072  1.56016898
## [279,]  1.25763955       -0.6945681 -0.25852440  1.19075249
## [280,]  0.05569031       -0.9784516 -1.25030599 -1.08731587
## [281,] -1.02606400        1.5764994 -1.05194967  1.12918307
## [282,]  0.89705478       -1.5462185 -0.85359335  0.51348892
## [283,]  1.61822432        1.2926159 -1.25030599  0.20564185
## [284,]  0.41627509       -0.4106847  0.73325719 -1.70301002
## [285,] -1.02606400       -0.9784516  0.13818823 -1.14888528
## [286,] -0.78567415       -0.6945681 -0.06016808 -1.21045470
## [287,]  1.13744463       -1.2623350  1.12996982  1.62173839
## [288,]  0.05569031       -1.5462185  1.32832614 -0.22534406
## [289,] -1.50684369        0.7248490  1.52668246 -1.70301002
## [290,]  0.29608016        1.0087325 -0.85359335  1.62173839
## [291,] -0.90586907        1.0087325 -0.45688072  1.56016898
## [292,] -1.26645385        1.2926159 -0.06016808 -0.53319113
## [293,] -1.14625892        1.5764994  0.73325719 -0.04063581
## [294,]  1.49802940        0.1570822  1.52668246  0.20564185
## [295,]  0.05569031        1.5764994 -1.05194967  1.43703015
## [296,]  1.25763955        1.2926159 -1.05194967 -0.47162172
## [297,]  0.53647001        1.2926159  0.13818823  0.57505834
## [298,] -1.02606400        0.1570822 -1.25030599  0.32878068
## [299,]  0.17588524       -1.2623350 -1.05194967 -1.33359353
## [300,]  0.05569031       -0.9784516 -0.65523704  1.56016898
## attr(,"scaled:center")
##       Behavior-3 Brand-Preference              CTA         Demo-Age 
##        16.536667         6.446667         9.303333        40.660000 
## attr(,"scaled:scale")
##       Behavior-3 Brand-Preference              CTA         Demo-Age 
##         8.319819         3.522573         5.041433        16.241830

Q4 What is the standardization for?

Standardization is to give equal wieght to all numeric variables

Q5 Find kmeans. What is kmeans for?

OurGroups <- kmeans(clusterdatastandardized, 3)
OurGroups
## K-means clustering with 3 clusters of sizes 76, 111, 113
## 
## Cluster means:
##   Behavior-3 Brand-Preference        CTA    Demo-Age
## 1 -0.2337264       -0.7356565 -0.2950637  1.01576573
## 2 -0.7672659        0.1033745  0.3133136 -0.74951611
## 3  0.9108825        0.3932330 -0.1093183  0.05308046
## 
## Clustering vector:
##   [1] 3 3 3 2 3 1 3 1 3 2 2 3 3 3 3 3 2 2 2 2 3 3 1 1 3 2 1 3 2 3 2 1 3 3 1 2 3
##  [38] 1 2 3 3 3 2 2 2 1 3 3 1 1 2 1 2 3 3 3 3 2 3 3 2 3 1 2 1 2 3 2 3 2 1 2 1 2
##  [75] 3 2 2 3 3 3 1 2 2 2 3 3 3 3 3 1 3 1 3 1 1 3 1 1 2 2 2 2 2 1 1 1 2 3 1 2 1
## [112] 2 2 3 1 2 2 2 3 2 3 2 2 3 3 3 2 2 3 3 1 1 1 1 3 1 3 3 1 3 2 2 2 3 2 2 2 2
## [149] 2 1 3 3 2 3 3 2 1 2 2 1 2 1 2 2 2 2 1 2 2 3 3 2 1 3 1 2 3 3 1 2 1 2 2 1 1
## [186] 2 3 1 3 2 2 2 3 1 1 2 3 3 1 2 2 3 3 3 3 3 3 1 3 2 3 1 2 3 3 1 2 3 2 1 3 1
## [223] 1 3 2 2 2 2 3 2 1 2 1 2 1 1 2 3 3 1 2 3 2 3 3 1 3 2 2 3 1 3 1 1 1 2 3 2 2
## [260] 3 3 3 1 3 3 3 2 3 3 3 2 3 1 3 2 2 2 1 1 2 1 1 3 2 2 2 1 2 2 3 1 2 2 3 3 3
## [297] 3 1 2 1
## 
## Within cluster sum of squares by cluster:
## [1] 181.7194 309.5504 321.7320
##  (between_SS / total_SS =  32.0 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
## [6] "betweenss"    "size"         "iter"         "ifault"

Assigns everyone in the group to clusters 1, 2, or 3 ## Q6 Visualize clusters

library(cluster)
clusplot(clusterdatastandardized, OurGroups$cluster)

## Q7 Summarize

OurGroups$size
## [1]  76 111 113

You can differentiate people based on the clustering and you can also see simmilarities/overlap within clsuters

Q8 Hide the messages, but display the code and its results on the webpage.

Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.

Q9 Display the title and your name correctly at the top of the webpage.

Q10 Use the correct slug.