Chapter 63 Analysis of Data ( Having Values Percentage)

PercentageOfNonNullValues = ( colSums(!is.na(FoodInspections)) / nrow(FoodInspections) ) * 100
PercentageOfNonNullValues = as.data.frame(PercentageOfNonNullValues)
PercentageOfNonNullValues = rownames_to_column(PercentageOfNonNullValues,"VariableName")

PercentageOfNonNullValues =  PercentageOfNonNullValues %>% arrange(desc(PercentageOfNonNullValues))

PercentageOfNonNullValues = PercentageOfNonNullValues %>%
  mutate(VariableName =  reorder(VariableName,PercentageOfNonNullValues))

ggplot(PercentageOfNonNullValues, aes(x = VariableName,y = PercentageOfNonNullValues)) +
  geom_bar(stat='identity',colour="white", fill =fillColor2) +
  geom_text(aes(x = VariableName, y = 1, label = paste0("(",round(PercentageOfNonNullValues,2),")",sep="")),
            hjust=0, vjust=.5, size = 4, colour = 'black',
            fontface = 'bold') +
  labs(x = 'VariableName', y = 'PercentageOfNonNullValues', 
       title = 'Variable Name and PercentageOfNonNullValues') +
  coord_flip() + 
  theme_bw()

We observe all the variables except one have more than 97% values. Therefore very few missing values, looking forward for an interesting analysis.