#Read the dataset into R

library (tidyverse)
## Warning: package 'ggplot2' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dlookr)
## Warning: package 'dlookr' was built under R version 4.3.3
## Registered S3 methods overwritten by 'dlookr':
##   method          from  
##   plot.transform  scales
##   print.transform scales
## 
## Attaching package: 'dlookr'
## 
## The following object is masked from 'package:tidyr':
## 
##     extract
## 
## The following object is masked from 'package:base':
## 
##     transform
library(caret)
## Warning: package 'caret' was built under R version 4.3.3
## Loading required package: lattice
## 
## Attaching package: 'caret'
## 
## The following object is masked from 'package:purrr':
## 
##     lift
library(flextable)
## Warning: package 'flextable' was built under R version 4.3.3
## 
## Attaching package: 'flextable'
## 
## The following object is masked from 'package:purrr':
## 
##     compose
library(gtsummary)
## Warning: package 'gtsummary' was built under R version 4.3.3
## #Uighur
## 
## Attaching package: 'gtsummary'
## 
## The following objects are masked from 'package:flextable':
## 
##     as_flextable, continuous_summary
library(factoextra)
## Warning: package 'factoextra' was built under R version 4.3.3
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(FactoMineR)
## Warning: package 'FactoMineR' was built under R version 4.3.3
library(readxl)
calculateddata <- read_excel("C:/Users/Michael/Desktop/calculateddata.xlsx", skip = 1)

#head(calculateddata)
#dim(calculateddata)

Data consists of 756 rows and 82 columns

#The first column 'JakesNEWCODE' is a row column. Convert the column to row

df <- calculateddata %>% column_to_rownames (var = "JakesNEWCODE")
#head(df)
#look at the colnames

#colnames(df)

Explore the demographic part of the data

The demographic data begins from column 1 to column 44

demo <- df %>% select(1:44) 
#head(demo)
#Replace the column names for the demographics with these
colnames(demo) <- c("CurrentlyHaveMentor", "ServeAsMentor", "PC_ServeAsMentor", "PrimaryJobFunction", "C5", "InstitutionRepresentation", "C7", "JobPath", "C9", "EmploymentStatus", "CurrentPosLevel", "ManagementExp_Years", "YearsToRetirement", "Age", "C15", "C16", "HighestEducationAttained", "C18", "C19", "C20", "C21", "C22", "C23", "C24", "C25", "C26", "C27", "C28", "C29", "C30", "C31", "C32", "C33", "C34", "C35", "C36", "C37", "C38", "C39", "C40", "C41", "Continent", "C43", "C44")

Some columns in the data contains missing values

Select columns that contains little missing data.

subset <- demo %>% select(1, 2, 3, 4, 6, 8, 10, 11, 12, 13, 14, 17, 42)
head(subset)
##   CurrentlyHaveMentor ServeAsMentor PC_ServeAsMentor  PrimaryJobFunction
## 1            Yes I do      Yes I do       Yes I have Facility Operations
## 2          No I don't    No I don't    No I have not Facility Operations
## 3            Yes I do      Yes I do       Yes I have Facility Operations
## 4    Maybe / not sure      Yes I do       Yes I have Facility Operations
## 5            Yes I do      Yes I do       Yes I have Facility Operations
## 6            Yes I do      Yes I do       Yes I have Facility Operations
##                                   InstitutionRepresentation
## 1 Educational (Training Center, K-12, College / University)
## 2 Educational (Training Center, K-12, College / University)
## 3                                        Federal Government
## 4 Educational (Training Center, K-12, College / University)
## 5   Insurance (Health, Life, Auto, Mutual, Casualty, Flood)
## 6 Educational (Training Center, K-12, College / University)
##                                                          JobPath
## 1 Managerial (e.g. supervising people, budgets, and/or projects)
## 2 Managerial (e.g. supervising people, budgets, and/or projects)
## 3 Managerial (e.g. supervising people, budgets, and/or projects)
## 4 Managerial (e.g. supervising people, budgets, and/or projects)
## 5 Managerial (e.g. supervising people, budgets, and/or projects)
## 6 Managerial (e.g. supervising people, budgets, and/or projects)
##                                                                       EmploymentStatus
## 1                              In-house - I am employed directly by the facility owner
## 2                              In-house - I am employed directly by the facility owner
## 3                              In-house - I am employed directly by the facility owner
## 4                              In-house - I am employed directly by the facility owner
## 5 Outsourced - I am employed by a contractor to provide services to the facility owner
## 6                              In-house - I am employed directly by the facility owner
##                                            CurrentPosLevel ManagementExp_Years
## 1            Level 3 - Manage supervisor who manage others         11-15 years
## 2       Level 4 - Manage two or more levels of supervisors  More than 30 years
## 3       Level 4 - Manage two or more levels of supervisors         16-20 years
## 4       Level 4 - Manage two or more levels of supervisors  More than 30 years
## 5 Level 2 - Manage employees but do not manage supervisors                <NA>
## 6       Level 4 - Manage two or more levels of supervisors         26-30 years
##   YearsToRetirement         Age HighestEducationAttained     Continent
## 1 More than 5 years 1979 - 1997        Bachelor's degree        Africa
## 2 More than 5 years 1946 - 1964        Bachelor's degree South America
## 3 More than 5 years 1979 - 1997        Bachelor's degree          Asia
## 4 More than 5 years 1965 - 1978        Bachelor's degree          Asia
## 5         3-5 years 1965 - 1978        Bachelor's degree North America
## 6 More than 5 years 1965 - 1978        Bachelor's degree North America

#Summarise the subsetted data.

-99 has to be removed

subset %>% tbl_summary()
Characteristic N = 7561
CurrentlyHaveMentor
    -99 3 (0.4%)
    Maybe / not sure 67 (8.9%)
    No I don't 468 (62%)
    Yes I do 218 (29%)
ServeAsMentor
    -99 7 (0.9%)
    Maybe / not sure 93 (12%)
    No I don't 272 (36%)
    Yes I do 384 (51%)
PC_ServeAsMentor
    Maybe / not sure 53 (7.0%)
    No I have not 118 (16%)
    Yes I have 585 (77%)
PrimaryJobFunction
    Architecture 2 (0.3%)
    Construction/Project Management 49 (6.5%)
    Consulting 38 (5.0%)
    Education 13 (1.7%)
    Engineering 18 (2.4%)
    Environmental Health and Safety 1 (0.1%)
    Facility Operations 545 (72%)
    Information Technology 6 (0.8%)
    Interior Design/Space Planning 8 (1.1%)
    Janitorial 4 (0.5%)
    Other 44 (5.8%)
    Real Estate 20 (2.6%)
    Sales 8 (1.1%)
InstitutionRepresentation
    Aircraft/Industrial (industrial Equipment, Aerospace) 9 (1.2%)
    Association (Association, Federation, Non-Profit Foundation, Society) 25 (3.3%)
    Banking (Consumer, Commercial, Savings, Credit Unions) 40 (5.3%)
    Building/Construction (Building, Construction Materials) 21 (2.8%)
    Charitable Foundation 11 (1.5%)
    Chemical/Pharmaceutical (Chemical, Pharmaceutical, Biotech) 21 (2.8%)
    City/County Government (Law Enforcement, Library, Parks / Public Open Space) 56 (7.4%)
    Computer (Computer hardware or software) 8 (1.1%)
    Consumer Products (Food, Paper, or related) 9 (1.2%)
    Corrections (private, state, federal, city, county) 1 (0.1%)
    Cultural Facilities (Private, Institutions, Government) 28 (3.7%)
    Educational (Training Center, K-12, College / University) 85 (11%)
    Electronics (Electronics, Telecommunications Equipment) 7 (0.9%)
    Energy (Energy related, mining, or distribution) 12 (1.6%)
    Federal Government 30 (4.0%)
    Health Care 43 (5.7%)
    Hospitality (Hotel, Restaurants, Hospitality-Related) 23 (3.0%)
    Information Services (Data Processing, Information Services, E-Commerce) 18 (2.4%)
    Insurance (Health, Life, Auto, Mutual, Casualty, Flood) 25 (3.3%)
    Investment Services (Securities and Investment Services) 5 (0.7%)
    Media (Broadcasting, Entertainment, Gaming, Media, Publishing) 12 (1.6%)
    Military 2 (0.3%)
    Motor Vehicles 6 (0.8%)
    Other Institution: 76 (10%)
    Professional Services (Legal, Accounting, Consulting, Engineering, Architecture) 80 (11%)
    Religious 12 (1.6%)
    Research 17 (2.2%)
    Special Districts/ Quasi-government (Transportation Authorities, School Boards) 3 (0.4%)
    State/Provincial Government 13 (1.7%)
    Telecommunications (Telecommunication, Internet Services/Products) 16 (2.1%)
    Trade (Wholesale, Retail) 15 (2.0%)
    Transportation (Transportation, Freight) 9 (1.2%)
    Utilities (Water, Gas, Electric, Energy Management) 18 (2.4%)
JobPath
    Managerial (e.g. supervising people, budgets, and/or projects) 675 (89%)
    Other 40 (5.3%)
    Technical (e.g. mechanical or systems focus - do not manage people of budgets) 40 (5.3%)
    Unknown 1
EmploymentStatus
    In-house - I am employed directly by the facility owner 580 (81%)
    Outsourced - I am employed by a contractor to provide services to the facility owner 138 (19%)
    Unknown 38
CurrentPosLevel
    Level 1 - Professional specialist (manage no employees) 55 (8.3%)
    Level 2 - Manage employees but do not manage supervisors 136 (21%)
    Level 3 - Manage supervisor who manage others 174 (26%)
    Level 4 - Manage two or more levels of supervisors 167 (25%)
    Level 5 - Senior executive 129 (20%)
    Unknown 95
ManagementExp_Years
    1-2 years 19 (4.2%)
    11-15 years 90 (20%)
    16-20 years 74 (16%)
    21-25 years 67 (15%)
    26-30 years 30 (6.6%)
    3-5 years 38 (8.4%)
    6-10 years 85 (19%)
    More than 30 years 49 (11%)
    Unknown 304
YearsToRetirement
    1-2 years 31 (4.1%)
    3-5 years 106 (14%)
    More than 5 years 580 (77%)
    Within the next year 36 (4.8%)
    Unknown 3
Age
    1946 - 1964 193 (26%)
    1965 - 1978 319 (42%)
    1979 - 1997 232 (31%)
    1998 or later 7 (0.9%)
    Prior to 1946 1 (0.1%)
    Unknown 4
HighestEducationAttained
    Associate's degree 43 (5.7%)
    Bachelor's degree 289 (38%)
    Doctorate degree 12 (1.6%)
    High school graduate or equivalent 30 (4.0%)
    Master's degree 239 (32%)
    Other 5 (0.7%)
    Some college, no degree 87 (12%)
    Vocational certificate, no degree 50 (6.6%)
    Unknown 1
Continent
    Africa 35 (4.6%)
    Asia 80 (11%)
    Australia 5 (0.7%)
    Europe 48 (6.4%)
    North America 568 (75%)
    South America 19 (2.5%)
    Unknown 1
1 n (%)

Demographic data summary based on CurrentPoslevel

subset %>%
  tbl_summary(by = CurrentPosLevel) 
## 95 observations missing `CurrentPosLevel` have been removed. To include these observations, use `forcats::fct_na_value_to_level()` on `CurrentPosLevel` column before passing to `tbl_summary()`.
Characteristic Level 1 - Professional specialist (manage no employees), N = 551 Level 2 - Manage employees but do not manage supervisors, N = 1361 Level 3 - Manage supervisor who manage others, N = 1741 Level 4 - Manage two or more levels of supervisors, N = 1671 Level 5 - Senior executive, N = 1291
CurrentlyHaveMentor




    -99 0 (0%) 0 (0%) 2 (1.1%) 1 (0.6%) 0 (0%)
    Maybe / not sure 4 (7.3%) 17 (13%) 17 (9.8%) 13 (7.8%) 9 (7.0%)
    No I don't 37 (67%) 83 (61%) 111 (64%) 96 (57%) 78 (60%)
    Yes I do 14 (25%) 36 (26%) 44 (25%) 57 (34%) 42 (33%)
ServeAsMentor




    -99 0 (0%) 1 (0.7%) 2 (1.1%) 0 (0%) 2 (1.6%)
    Maybe / not sure 8 (15%) 23 (17%) 22 (13%) 16 (9.6%) 14 (11%)
    No I don't 29 (53%) 62 (46%) 65 (37%) 46 (28%) 25 (19%)
    Yes I do 18 (33%) 50 (37%) 85 (49%) 105 (63%) 88 (68%)
PC_ServeAsMentor




    Maybe / not sure 8 (15%) 16 (12%) 10 (5.7%) 6 (3.6%) 4 (3.1%)
    No I have not 12 (22%) 31 (23%) 32 (18%) 14 (8.4%) 8 (6.2%)
    Yes I have 35 (64%) 89 (65%) 132 (76%) 147 (88%) 117 (91%)
PrimaryJobFunction




    Architecture 1 (1.8%) 0 (0%) 1 (0.6%) 0 (0%) 0 (0%)
    Construction/Project Management 9 (16%) 8 (5.9%) 14 (8.0%) 8 (4.8%) 5 (3.9%)
    Consulting 7 (13%) 2 (1.5%) 5 (2.9%) 2 (1.2%) 14 (11%)
    Education 2 (3.6%) 1 (0.7%) 1 (0.6%) 1 (0.6%) 1 (0.8%)
    Engineering 0 (0%) 2 (1.5%) 3 (1.7%) 2 (1.2%) 4 (3.1%)
    Environmental Health and Safety 0 (0%) 0 (0%) 0 (0%) 0 (0%) 1 (0.8%)
    Facility Operations 30 (55%) 109 (80%) 134 (77%) 138 (83%) 84 (65%)
    Information Technology 0 (0%) 2 (1.5%) 1 (0.6%) 0 (0%) 1 (0.8%)
    Interior Design/Space Planning 0 (0%) 3 (2.2%) 2 (1.1%) 2 (1.2%) 0 (0%)
    Janitorial 0 (0%) 0 (0%) 1 (0.6%) 1 (0.6%) 1 (0.8%)
    Other 3 (5.5%) 6 (4.4%) 10 (5.7%) 6 (3.6%) 10 (7.8%)
    Real Estate 1 (1.8%) 0 (0%) 2 (1.1%) 7 (4.2%) 8 (6.2%)
    Sales 2 (3.6%) 3 (2.2%) 0 (0%) 0 (0%) 0 (0%)
InstitutionRepresentation




    Aircraft/Industrial (industrial Equipment, Aerospace) 0 (0%) 0 (0%) 4 (2.3%) 5 (3.0%) 0 (0%)
    Association (Association, Federation, Non-Profit Foundation, Society) 0 (0%) 3 (2.2%) 8 (4.6%) 9 (5.4%) 4 (3.1%)
    Banking (Consumer, Commercial, Savings, Credit Unions) 5 (9.1%) 9 (6.6%) 9 (5.2%) 5 (3.0%) 8 (6.2%)
    Building/Construction (Building, Construction Materials) 0 (0%) 4 (2.9%) 4 (2.3%) 4 (2.4%) 3 (2.3%)
    Charitable Foundation 1 (1.8%) 2 (1.5%) 6 (3.4%) 0 (0%) 0 (0%)
    Chemical/Pharmaceutical (Chemical, Pharmaceutical, Biotech) 1 (1.8%) 6 (4.4%) 4 (2.3%) 6 (3.6%) 3 (2.3%)
    City/County Government (Law Enforcement, Library, Parks / Public Open Space) 3 (5.5%) 6 (4.4%) 16 (9.2%) 21 (13%) 8 (6.2%)
    Computer (Computer hardware or software) 2 (3.6%) 3 (2.2%) 1 (0.6%) 0 (0%) 1 (0.8%)
    Consumer Products (Food, Paper, or related) 3 (5.5%) 3 (2.2%) 2 (1.1%) 0 (0%) 0 (0%)
    Corrections (private, state, federal, city, county) 0 (0%) 0 (0%) 1 (0.6%) 0 (0%) 0 (0%)
    Cultural Facilities (Private, Institutions, Government) 0 (0%) 8 (5.9%) 5 (2.9%) 5 (3.0%) 6 (4.7%)
    Educational (Training Center, K-12, College / University) 4 (7.3%) 10 (7.4%) 17 (9.8%) 27 (16%) 16 (12%)
    Electronics (Electronics, Telecommunications Equipment) 0 (0%) 0 (0%) 4 (2.3%) 2 (1.2%) 1 (0.8%)
    Energy (Energy related, mining, or distribution) 1 (1.8%) 4 (2.9%) 1 (0.6%) 1 (0.6%) 1 (0.8%)
    Federal Government 4 (7.3%) 4 (2.9%) 6 (3.4%) 9 (5.4%) 3 (2.3%)
    Health Care 3 (5.5%) 3 (2.2%) 9 (5.2%) 13 (7.8%) 12 (9.3%)
    Hospitality (Hotel, Restaurants, Hospitality-Related) 1 (1.8%) 1 (0.7%) 7 (4.0%) 6 (3.6%) 6 (4.7%)
    Information Services (Data Processing, Information Services, E-Commerce) 1 (1.8%) 8 (5.9%) 6 (3.4%) 1 (0.6%) 2 (1.6%)
    Insurance (Health, Life, Auto, Mutual, Casualty, Flood) 1 (1.8%) 8 (5.9%) 6 (3.4%) 4 (2.4%) 3 (2.3%)
    Investment Services (Securities and Investment Services) 1 (1.8%) 0 (0%) 2 (1.1%) 0 (0%) 1 (0.8%)
    Media (Broadcasting, Entertainment, Gaming, Media, Publishing) 1 (1.8%) 0 (0%) 1 (0.6%) 1 (0.6%) 5 (3.9%)
    Military 0 (0%) 0 (0%) 1 (0.6%) 0 (0%) 1 (0.8%)
    Motor Vehicles 0 (0%) 1 (0.7%) 1 (0.6%) 3 (1.8%) 1 (0.8%)
    Other Institution: 6 (11%) 10 (7.4%) 13 (7.5%) 15 (9.0%) 12 (9.3%)
    Professional Services (Legal, Accounting, Consulting, Engineering, Architecture) 12 (22%) 13 (9.6%) 13 (7.5%) 11 (6.6%) 21 (16%)
    Religious 0 (0%) 5 (3.7%) 4 (2.3%) 2 (1.2%) 0 (0%)
    Research 1 (1.8%) 4 (2.9%) 4 (2.3%) 3 (1.8%) 2 (1.6%)
    Special Districts/ Quasi-government (Transportation Authorities, School Boards) 0 (0%) 1 (0.7%) 0 (0%) 1 (0.6%) 1 (0.8%)
    State/Provincial Government 1 (1.8%) 4 (2.9%) 3 (1.7%) 1 (0.6%) 1 (0.8%)
    Telecommunications (Telecommunication, Internet Services/Products) 1 (1.8%) 3 (2.2%) 3 (1.7%) 4 (2.4%) 3 (2.3%)
    Trade (Wholesale, Retail) 1 (1.8%) 4 (2.9%) 7 (4.0%) 2 (1.2%) 0 (0%)
    Transportation (Transportation, Freight) 0 (0%) 2 (1.5%) 3 (1.7%) 3 (1.8%) 0 (0%)
    Utilities (Water, Gas, Electric, Energy Management) 1 (1.8%) 7 (5.1%) 3 (1.7%) 3 (1.8%) 4 (3.1%)
JobPath




    Managerial (e.g. supervising people, budgets, and/or projects) 55 (100%) 136 (100%) 174 (100%) 167 (100%) 129 (100%)
EmploymentStatus




    In-house - I am employed directly by the facility owner 38 (76%) 111 (86%) 139 (82%) 133 (81%) 98 (80%)
    Outsourced - I am employed by a contractor to provide services to the facility owner 12 (24%) 18 (14%) 31 (18%) 32 (19%) 25 (20%)
    Unknown 5 7 4 2 6
ManagementExp_Years




    1-2 years 5 (18%) 7 (7.5%) 3 (2.5%) 3 (2.4%) 0 (0%)
    11-15 years 7 (25%) 16 (17%) 28 (23%) 30 (24%) 8 (11%)
    16-20 years 3 (11%) 9 (9.7%) 18 (15%) 30 (24%) 13 (17%)
    21-25 years 1 (3.6%) 8 (8.6%) 14 (12%) 22 (17%) 19 (25%)
    26-30 years 1 (3.6%) 3 (3.2%) 7 (5.8%) 11 (8.7%) 8 (11%)
    3-5 years 1 (3.6%) 20 (22%) 11 (9.1%) 2 (1.6%) 4 (5.3%)
    6-10 years 8 (29%) 23 (25%) 33 (27%) 12 (9.4%) 8 (11%)
    More than 30 years 2 (7.1%) 7 (7.5%) 7 (5.8%) 17 (13%) 16 (21%)
    Unknown 27 43 53 40 53
YearsToRetirement




    1-2 years 1 (1.8%) 6 (4.4%) 7 (4.0%) 7 (4.2%) 7 (5.5%)
    3-5 years 8 (15%) 10 (7.4%) 23 (13%) 31 (19%) 23 (18%)
    More than 5 years 43 (78%) 116 (85%) 138 (79%) 120 (73%) 88 (69%)
    Within the next year 3 (5.5%) 4 (2.9%) 6 (3.4%) 7 (4.2%) 10 (7.8%)
    Unknown 0 0 0 2 1
Age




    1946 - 1964 11 (20%) 23 (17%) 38 (22%) 49 (30%) 50 (39%)
    1965 - 1978 16 (30%) 57 (42%) 78 (45%) 67 (41%) 61 (47%)
    1979 - 1997 24 (44%) 54 (40%) 57 (33%) 48 (29%) 17 (13%)
    1998 or later 3 (5.6%) 2 (1.5%) 0 (0%) 1 (0.6%) 0 (0%)
    Prior to 1946 0 (0%) 0 (0%) 0 (0%) 0 (0%) 1 (0.8%)
    Unknown 1 0 1 2 0
HighestEducationAttained




    Associate's degree 2 (3.6%) 6 (4.4%) 7 (4.0%) 13 (7.8%) 9 (7.0%)
    Bachelor's degree 23 (42%) 60 (44%) 71 (41%) 62 (37%) 36 (28%)
    Doctorate degree 0 (0%) 0 (0%) 1 (0.6%) 0 (0%) 8 (6.2%)
    High school graduate or equivalent 3 (5.5%) 5 (3.7%) 6 (3.4%) 6 (3.6%) 3 (2.3%)
    Master's degree 15 (27%) 30 (22%) 51 (29%) 57 (34%) 63 (49%)
    Other 1 (1.8%) 3 (2.2%) 1 (0.6%) 0 (0%) 0 (0%)
    Some college, no degree 9 (16%) 24 (18%) 20 (11%) 21 (13%) 3 (2.3%)
    Vocational certificate, no degree 2 (3.6%) 8 (5.9%) 17 (9.8%) 7 (4.2%) 7 (5.4%)
    Unknown 0 0 0 1 0
Continent




    Africa 2 (3.6%) 4 (3.0%) 5 (2.9%) 13 (7.8%) 5 (3.9%)
    Asia 4 (7.3%) 8 (5.9%) 17 (9.8%) 19 (11%) 24 (19%)
    Australia 1 (1.8%) 1 (0.7%) 1 (0.6%) 2 (1.2%) 0 (0%)
    Europe 5 (9.1%) 9 (6.7%) 7 (4.0%) 7 (4.2%) 16 (12%)
    North America 43 (78%) 109 (81%) 137 (79%) 121 (72%) 82 (64%)
    South America 0 (0%) 4 (3.0%) 7 (4.0%) 5 (3.0%) 2 (1.6%)
    Unknown 0 1 0 0 0
1 n (%)

#Lets explore the Hexaco data**

hexaco <- df %>% select(49,54,59,64,69,74)
head(hexaco)
##   Honesty/Humility Emotionality Extraversion Agreeableness Conscientiousness
## 1             4.42         3.17         3.42          4.67              4.54
## 2             4.25         2.54         4.04          3.38              4.71
## 3             4.29         1.96         3.71          4.13              3.92
## 4             3.79         2.96         3.21          3.38              3.42
## 5             4.08         2.71         3.67          3.58              4.42
## 6             3.79         2.13         3.29          3.58              4.33
##   Openness to Experience
## 1                   3.33
## 2                   3.88
## 3                   4.04
## 4                   2.54
## 5                   2.58
## 6                   2.71

#Summary of hexaco data

flextable(describe(hexaco) %>% select(1,2,3,4,5))

described_variables

n

na

mean

sd

Honesty/Humility

756

0

3.907831

0.4800359

Emotionality

756

0

2.782368

0.5519061

Extraversion

756

0

3.568135

0.5464286

Agreeableness

756

0

3.412407

0.5211523

Conscientiousness

756

0

4.063968

0.4541863

Openness to Experience

756

0

3.184894

0.4951469

hexaco %>% tbl_summary(statistic = list(
      all_continuous() ~ "{mean} ({sd})"))
Characteristic N = 7561
Honesty/Humility 3.91 (0.48)
Emotionality 2.78 (0.55)
Extraversion 3.57 (0.55)
Agreeableness 3.41 (0.52)
Conscientiousness 4.06 (0.45)
Openness to Experience 3.18 (0.50)
1 Mean (SD)

#Comparison between CurrentPoslevel personality traits.

hexaco_level <- df %>% select(49,54,59,64,69,74)
head(hexaco_level)
##   Honesty/Humility Emotionality Extraversion Agreeableness Conscientiousness
## 1             4.42         3.17         3.42          4.67              4.54
## 2             4.25         2.54         4.04          3.38              4.71
## 3             4.29         1.96         3.71          4.13              3.92
## 4             3.79         2.96         3.21          3.38              3.42
## 5             4.08         2.71         3.67          3.58              4.42
## 6             3.79         2.13         3.29          3.58              4.33
##   Openness to Experience
## 1                   3.33
## 2                   3.88
## 3                   4.04
## 4                   2.54
## 5                   2.58
## 6                   2.71
hexaco_level$CurrentPosLevel <- demo$CurrentPosLevel # add gender column to the hexaco data
head(hexaco_level)
##   Honesty/Humility Emotionality Extraversion Agreeableness Conscientiousness
## 1             4.42         3.17         3.42          4.67              4.54
## 2             4.25         2.54         4.04          3.38              4.71
## 3             4.29         1.96         3.71          4.13              3.92
## 4             3.79         2.96         3.21          3.38              3.42
## 5             4.08         2.71         3.67          3.58              4.42
## 6             3.79         2.13         3.29          3.58              4.33
##   Openness to Experience
## 1                   3.33
## 2                   3.88
## 3                   4.04
## 4                   2.54
## 5                   2.58
## 6                   2.71
##                                            CurrentPosLevel
## 1            Level 3 - Manage supervisor who manage others
## 2       Level 4 - Manage two or more levels of supervisors
## 3       Level 4 - Manage two or more levels of supervisors
## 4       Level 4 - Manage two or more levels of supervisors
## 5 Level 2 - Manage employees but do not manage supervisors
## 6       Level 4 - Manage two or more levels of supervisors
hexaco_level %>%
  tbl_summary(
    by = CurrentPosLevel,
    statistic = list(
      all_continuous() ~ "{mean} ({sd})",
      all_categorical() ~ "{n} / {N} ({p}%)"
    ),
    digits = all_continuous() ~ 2,
    
  ) %>% add_p()
## 95 observations missing `CurrentPosLevel` have been removed. To include these observations, use `forcats::fct_na_value_to_level()` on `CurrentPosLevel` column before passing to `tbl_summary()`.
Characteristic Level 1 - Professional specialist (manage no employees), N = 551 Level 2 - Manage employees but do not manage supervisors, N = 1361 Level 3 - Manage supervisor who manage others, N = 1741 Level 4 - Manage two or more levels of supervisors, N = 1671 Level 5 - Senior executive, N = 1291 p-value2
Honesty/Humility 3.81 (0.61) 3.91 (0.48) 3.91 (0.48) 3.93 (0.45) 3.94 (0.47) >0.9
Emotionality 2.96 (0.55) 2.82 (0.57) 2.76 (0.58) 2.69 (0.50) 2.74 (0.56) 0.031
Extraversion 3.43 (0.64) 3.48 (0.52) 3.52 (0.55) 3.65 (0.49) 3.74 (0.48) <0.001
Agreeableness 3.29 (0.57) 3.35 (0.57) 3.45 (0.47) 3.44 (0.50) 3.47 (0.49) 0.3
Conscientiousness 4.01 (0.47) 4.02 (0.45) 4.00 (0.49) 4.10 (0.42) 4.16 (0.45) 0.018
Openness to Experience 3.18 (0.50) 3.15 (0.45) 3.19 (0.52) 3.20 (0.51) 3.22 (0.45) 0.5
1 Mean (SD)
2 Kruskal-Wallis rank sum test

#Impact of Hexaco on Emotional intelligence

hexaco_EQ <- df %>% select(49,54,59,64,69,74,78)
head(hexaco_EQ)
##   Honesty/Humility Emotionality Extraversion Agreeableness Conscientiousness
## 1             4.42         3.17         3.42          4.67              4.54
## 2             4.25         2.54         4.04          3.38              4.71
## 3             4.29         1.96         3.71          4.13              3.92
## 4             3.79         2.96         3.21          3.38              3.42
## 5             4.08         2.71         3.67          3.58              4.42
## 6             3.79         2.13         3.29          3.58              4.33
##   Openness to Experience Overall EQ
## 1                   3.33         87
## 2                   3.88         88
## 3                   4.04         86
## 4                   2.54         79
## 5                   2.58         84
## 6                   2.71         72

Correlation of Hexaco with EQ

library(metan)
## Warning: package 'metan' was built under R version 4.3.3
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
## Warning in check_dep_version(): ABI version mismatch: 
## lme4 was built with Matrix ABI version 1
## Current Matrix ABI version is 0
## Please re-install lme4 from source or restore original 'Matrix' package
## |=========================================================|
## | Multi-Environment Trial Analysis (metan) v1.18.0        |
## | Author: Tiago Olivoto                                   |
## | Type 'citation('metan')' to know how to cite metan      |
## | Type 'vignette('metan_start')' for a short tutorial     |
## | Visit 'https://bit.ly/pkgmetan' for a complete tutorial |
## |=========================================================|
## 
## Attaching package: 'metan'
## The following object is masked from 'package:factoextra':
## 
##     get_dist
## The following object is masked from 'package:caret':
## 
##     progress
## The following object is masked from 'package:dlookr':
## 
##     find_outliers
## The following object is masked from 'package:forcats':
## 
##     as_factor
## The following object is masked from 'package:dplyr':
## 
##     recode_factor
## The following object is masked from 'package:tidyr':
## 
##     replace_na
## The following objects are masked from 'package:tibble':
## 
##     column_to_rownames, remove_rownames, rownames_to_column
corr <- corr_coef(hexaco_EQ)
plot(corr)