suppressPackageStartupMessages(library(tidyverse))
## Warning: package 'tidyverse' was built under R version 4.1.3
## Warning: package 'ggplot2' was built under R version 4.1.3
## Warning: package 'tibble' was built under R version 4.1.3
## Warning: package 'tidyr' was built under R version 4.1.3
## Warning: package 'readr' was built under R version 4.1.3
## Warning: package 'purrr' was built under R version 4.1.3
## Warning: package 'dplyr' was built under R version 4.1.3
## Warning: package 'stringr' was built under R version 4.1.3
## Warning: package 'forcats' was built under R version 4.1.3
suppressPackageStartupMessages(library(dplyr))
##questions to be answered by vizualizing data
spread of the values of variable “Underweight”
Spread of the values of variable “Overweight”
Spread of the values of variable “Wasting”
Spread of the values of variable “Stunting”
Relationship between Underweight and Stunting
Relationship between Severe Wasting and Wasting
cn <- c %>%
drop_na()
##Graphical representation of values for the variable ‘Underweight’
ggplot(cn)+
geom_histogram(aes(x = Underweight), colour= "blue", fill= "blue")+
labs(
title = "Distribution of values for the variable 'Underweight'",
x = 'Underweight',
y = '% of children below age 5'
)
##Graphical representation of values for the variable ‘Overweight’
ggplot(cn)+
geom_bar(aes(x = Overweight), fill="black", width = 0.5)+
labs(
title = "Distribution of values for the variable 'Overweight'",
x = 'Overweight',
y = '% of children below age 5'
)
## Warning: position_stack requires non-overlapping x intervals
##The average Overweight value is:
cn %>%
summarize(avg.weight = mean(Overweight))
## avg.weight
## 1 7.067651
##Graphical representation of the variable ‘Wasting’, where values are more than 5
cn %>%
filter(Wasting > 5) %>%
ggplot()+
geom_density(aes(x = Wasting, fill="coral3")) +
labs(
title = "Observing the values where wasting is more than 5.00",
x = 'Wasting',
y = 'Spread of variables above the value 5'
)
##Graphical representation of values for the variable ‘Severe wasting’
set.seed(3)
x <- 1:20
y <- x + rnorm(20, mean = 0, sd = 10)
plot(x, y, pch = 19, col = "black")
abline(lm(y ~ x), col = "red", lwd = 3)
##Graphical representation of relationship between ‘Underweight’ and ‘Stunting’
input <- cn[,c('Underweight','Stunting')]
plot(x = input$Underweight,y = input$Stunting,
xlab = "Underweight",
ylab = "Stunting",
xlim = c(0,10),
ylim = c(0,10),
main = "Underweight vs Stunting")
input <- cn[,c('Stunting','Wasting')]
plot(x = input$Stunting,y = input$Wasting,
xlab = "Stunting",
ylab = "Wasting",
xlim = c(0,15),
ylim = c(0,15),
main = "Stunting vs wasting")