Team-32

Author

Data visionaries

Build a parallel coordinates plot to compare health indicators across multiple countries.

Introduction:

Health indicators are important measures that reflect the overall well-being and development of a country. Comparing multiple indicators helps identify patterns and differences between countries. In this report, a parallel coordinates plot is used to visualize and compare health indicators across multiple countries.

Objective:

To analyze and compare key health indicators such as life expectancy, infant mortality, GDP per capital, and health expenditure using R programming.

Step 1: Load required package

We use the GGally package to create a parallel coordinates plot

library("GGally")
Warning: package 'GGally' was built under R version 4.5.3
Loading required package: ggplot2
Warning: package 'ggplot2' was built under R version 4.5.3
library(ggplot2)

Step 2: Create dataset

We create a dataset containing different countries and their health indicators.

health_data <- data.frame(
  Country = c("India", "USA", "UK", "China", "Brazil"),
  LifeExpectancy = c(69, 78, 81, 77, 75),
  InfantMortality = c(27, 5, 4, 7, 12),
  GDP = c(2000, 65000, 42000, 10000, 9000),
  HealthExp = c(150, 10000, 5000, 800, 1200)
)
head(health_data)
  Country LifeExpectancy InfantMortality   GDP HealthExp
1   India             69              27  2000       150
2     USA             78               5 65000     10000
3      UK             81               4 42000      5000
4   China             77               7 10000       800
5  Brazil             75              12  9000      1200

Step 3: Check structure of dataset

str(health_data)
'data.frame':   5 obs. of  5 variables:
 $ Country        : chr  "India" "USA" "UK" "China" ...
 $ LifeExpectancy : num  69 78 81 77 75
 $ InfantMortality: num  27 5 4 7 12
 $ GDP            : num  2000 65000 42000 10000 9000
 $ HealthExp      : num  150 10000 5000 800 1200

Step 4: Create Parallel Coordinates Plot

GGally::ggparcoord(
  data = health_data,
  columns = 2:5,
  groupColumn = 1,
  scale = "uniminmax"
) +
  ggtitle("Parallel Coordinates Plot of Health Indicators") +
  theme_minimal()