# R code to display the barplot of number of OCV agaist the count as per county 
library(readxl)
ACTIVE <- read_excel("D:/PERIS/ACTIVE.xlsx")
ACTIVE
## # A tibble: 64,162 × 57
##    cbo_id cbo          ward_id ward  consituency_id constituency countyid county
##     <dbl> <chr>          <dbl> <chr>          <dbl> <chr>           <dbl> <chr> 
##  1   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  2   7306 CHEER UP PR…     911 Kiuu             162 Ruiru              22 Kiambu
##  3   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  4   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  5   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  6   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  7   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  8   7306 CHEER UP PR…     911 Kiuu             162 Ruiru              22 Kiambu
##  9   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
## 10   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
## # ℹ 64,152 more rows
## # ℹ 49 more variables: cpims_ovc_id <dbl>, ovc_names <chr>, gender <chr>,
## #   dob <chr>, date_of_birth <chr>, age <dbl>, age_at_reg <dbl>,
## #   agerange <chr>, birthcert <chr>, bcertnumber <chr>, ovcdisability <chr>,
## #   ncpwdnumber <chr>, ovchivstatus <chr>, artstatus <chr>, facility_id <dbl>,
## #   facility <chr>, facility_mfl_code <dbl>, date_of_linkage <chr>,
## #   ccc_number <chr>, duration_on_art <chr>, viral_load <dbl>, …
number_of_children <- table(ACTIVE$county)
barplot(number_of_children, xlab = "county", ylab = "count", col = "blue", main = "BARPLOT OF NUMBER OF OVC AGAINST THE COUNT")
barplot

barplot

# with or without birth certificate
OVCwith_without_berthcertficate <- table(ACTIVE$birthcert)
barplot(OVCwith_without_berthcertficate, xlab = "Birth certificate status", ylab = "count", main = "BARPLOT OF OVC WITH AND WITHOUT BIRTH CERTIFICATE", col = "red")
barplot

barplot

# with or without HIV
with_without_HIV_ovc <- table(ACTIVE$ovchivstatus)
barplot(with_without_HIV_ovc, xlab = "HIV status", ylab = "count", col = "green", main = "BARPLOT TO SHOW OVC WITH/WITHOUT HIV")
barplot

barplot

# barplot to show the age range of OVC
age_range <- table(ACTIVE$agerange)
barplot(age_range, xlab = "Age range", ylab = "count", col = "skyblue", main = "BARPLOT OF OVC AGE RANGE AGAINST COUNT")
barplot

barplot

library(readxl)
ACTIVE <- read_excel("D:/PERIS/ACTIVE.xlsx")
ACTIVE
## # A tibble: 64,162 × 57
##    cbo_id cbo          ward_id ward  consituency_id constituency countyid county
##     <dbl> <chr>          <dbl> <chr>          <dbl> <chr>           <dbl> <chr> 
##  1   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  2   7306 CHEER UP PR…     911 Kiuu             162 Ruiru              22 Kiambu
##  3   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  4   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  5   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  6   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  7   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
##  8   7306 CHEER UP PR…     911 Kiuu             162 Ruiru              22 Kiambu
##  9   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
## 10   7306 CHEER UP PR…     912 Mwiki            162 Ruiru              22 Kiambu
## # ℹ 64,152 more rows
## # ℹ 49 more variables: cpims_ovc_id <dbl>, ovc_names <chr>, gender <chr>,
## #   dob <chr>, date_of_birth <chr>, age <dbl>, age_at_reg <dbl>,
## #   agerange <chr>, birthcert <chr>, bcertnumber <chr>, ovcdisability <chr>,
## #   ncpwdnumber <chr>, ovchivstatus <chr>, artstatus <chr>, facility_id <dbl>,
## #   facility <chr>, facility_mfl_code <dbl>, date_of_linkage <chr>,
## #   ccc_number <chr>, duration_on_art <chr>, viral_load <dbl>, …
ovcdisability<-table(ACTIVE$ovcdisability)
ovcdisability
## 
## HAS DISABILITY  NO DISABILITY 
##            147          64015
barplot(ovcdisability, ylab = "Count", ylim = c(0, max(ovcdisability) + 5000), 
        beside = TRUE, col = c("blue", "red"), names.arg = levels(ACTIVE$ovcdisability),
        main = "Counts of Disability",
        args.legend = list(title = "Disability Type"))

# Add counts on the bars
text(x = barplot(ovcdisability, plot = FALSE), y = ovcdisability/2, labels = ovcdisability, pos = 3, cex = 0.9, col = "black")
barplot

barplot

library(readxl)
caregiverhivstatus<-table(ACTIVE$caregiverhivstatus)
caregiverhivstatus
## 
##         HEI NOT KNOWN HIV Test Not Required              NEGATIVE 
##                    15                     8                  6079 
##             NOT KNOWN              POSITIVE 
##                  1258                 54174
# Sample data based on the counts you provided
caregiverhivstatus <- c("HEI NOT KNOWN", "HIV Test Not Required", "NEGATIVE", "NOT KNOWN", "POSITIVE")
counts <- c(15, 8, 6079, 1258, 54174)

# Create a bar plot with counts displayed inside the bars using rainbow colors
barplot(counts, names.arg = caregiverhivstatus,xlab = "care giver hiv status", ylab = "Count", col = rainbow(length(counts)),
        main = "Caregiver HIV Status")

# Add counts inside the bars
text(x = 1:length(caregiverhivstatus), y = counts/2, labels = counts, pos = 3, cex = 0.9, col = "black")
barplot

barplot

library(readxl)
schoollevel<-table(ACTIVE$schoollevel)
schoollevel
## 
##          ECDE Not in School       Primary     Secondary      Tertiary 
##          6978         10838         30755         15500            82 
##    University 
##             9
# Sample data based on the counts you provided
education_levels <- c("ECDE","Not in School", "Primary", "Secondary", "Tertiary", "University")
counts <- c(6978, 10838, 30755, 15500, 82, 9)

# Create a bar plot with counts displayed inside the bars using rainbow colors
barplot(counts, names.arg = education_levels,xlab = "Education level", ylab = "Count", col = rainbow(length(counts)),
        main = "Education Levels")

# Add counts inside the bars
text(x = 1:length(education_levels), y = counts/2, labels = counts, pos = 3, cex = 0.7, col = "black")
barplot

barplot

immunization<-table(ACTIVE$immunization)
immunization
## 
## Fully Immunized   Not Completed   Not Immunized       Not Known 
##            5398           10571             166           48027
# Sample data based on the counts you provided
immunization_status <- c("Fully Immunized", "Not Completed", "Not Immunized", "Not Known")
counts <- c(5398, 10571, 166, 48027)

# Create a bar plot with counts displayed inside the bars using rainbow colors
barplot(counts, names.arg = immunization_status,xlab = "imunization status", ylab = "Count", col = rainbow(length(counts)),
        main = "Immunization Status")

# Add counts inside the bars
text(x = 1:length(immunization_status), y = counts/2, labels = counts, pos = 3, cex = 0.9, col = "black")
barplot

barplot