CROSS-TABULATION:

Cross-tabulation is one of the most useful analytical tools and a mainstay of the market research industry. Cross-tabulation analysis, also known as contingency table analysis, is most often used to analyze categorical (nominal measurement scale) data.

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6     ✔ purrr   0.3.4
## ✔ tibble  3.1.7     ✔ dplyr   1.0.9
## ✔ tidyr   1.2.0     ✔ stringr 1.4.0
## ✔ readr   2.1.2     ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(stringr)
library(gmodels)
library(ggplot2)

I will like to release the commands so that you can go ahead to practice them …..if any issue arises, you are very free to contact me for further discussions.

 ID = seq(1:2500)
set.seed(234)
Age = sample(c("0 - 5", "6 - 14", "15 - 24", "25 - 50", "51 - 64", "65+ "), 2500, replace = TRUE)   #View(Age)

set.seed(234)
Gender = sample(c("Male", "Female"), 2500, replace = TRUE)   #View(Gender)

set.seed(234)
Country = sample(c("Nigeria", "Ghana", "South Africa", "Botswana", "United Kingdom", "Austria"), 2500, replace = TRUE)    #View(Country)

set.seed(234)
Health_Status = sample(c("Poor", "Fair", "Okay"), 2500, replace = TRUE)    
# View(Health_Status)

Survey = data.frame(Age, Gender, Country, Health_Status)
View(Survey)

head(Survey, 50)    
##        Age Gender        Country Health_Status
## 1    0 - 5   Male        Nigeria          Poor
## 2   6 - 14   Male          Ghana          Okay
## 3     65+  Female        Austria          Fair
## 4   6 - 14 Female          Ghana          Fair
## 5   6 - 14 Female          Ghana          Fair
## 6  51 - 64 Female United Kingdom          Fair
## 7    0 - 5   Male        Nigeria          Poor
## 8  25 - 50 Female       Botswana          Poor
## 9  25 - 50   Male       Botswana          Okay
## 10    65+  Female        Austria          Fair
## 11    65+  Female        Austria          Okay
## 12 15 - 24   Male   South Africa          Okay
## 13  6 - 14 Female          Ghana          Fair
## 14  6 - 14   Male          Ghana          Okay
## 15 51 - 64   Male United Kingdom          Fair
## 16   0 - 5 Female        Nigeria          Fair
## 17    65+    Male        Austria          Poor
## 18 15 - 24 Female   South Africa          Poor
## 19 15 - 24 Female   South Africa          Fair
## 20   0 - 5   Male        Nigeria          Okay
## 21 51 - 64 Female United Kingdom          Okay
## 22 25 - 50   Male       Botswana          Poor
## 23 51 - 64 Female United Kingdom          Poor
## 24    65+  Female        Austria          Poor
## 25  6 - 14   Male          Ghana          Fair
## 26 15 - 24   Male   South Africa          Fair
## 27  6 - 14   Male          Ghana          Okay
## 28  6 - 14   Male          Ghana          Fair
## 29  6 - 14 Female          Ghana          Fair
## 30 25 - 50   Male       Botswana          Fair
## 31    65+  Female        Austria          Okay
## 32 15 - 24 Female   South Africa          Okay
## 33 15 - 24 Female   South Africa          Fair
## 34 15 - 24 Female   South Africa          Okay
## 35 51 - 64   Male United Kingdom          Okay
## 36    65+  Female        Austria          Okay
## 37  6 - 14 Female          Ghana          Okay
## 38   0 - 5 Female        Nigeria          Poor
## 39   0 - 5   Male        Nigeria          Fair
## 40 51 - 64   Male United Kingdom          Okay
## 41   0 - 5 Female        Nigeria          Okay
## 42    65+  Female        Austria          Fair
## 43 51 - 64   Male United Kingdom          Poor
## 44  6 - 14 Female          Ghana          Poor
## 45  6 - 14   Male          Ghana          Poor
## 46   0 - 5   Male        Nigeria          Okay
## 47    65+    Male        Austria          Okay
## 48   0 - 5   Male        Nigeria          Poor
## 49  6 - 14 Female          Ghana          Fair
## 50   0 - 5 Female        Nigeria          Okay