Dealing with missing data is an important step in data cleaning
With a large data set we might need to remove rows with NA’s, but our approaches may vary according to the goal of the analysis
NixNA package has two functions that will help clean our data and prepare us for next steps
install the development version from GitHub
devtools::install_github(“sarraalii/NixNa”)
library(NixNa)
trimun: Remove Rows for Unique Values with Missing Covariates
library(trimun)
-In a large dataset capturing socio-economic indicators for 181 countries, you aim to perform a country-level analysis.
-However, missing values in certain covariates might affect the integrity of your results.
-You want to remove all unique values in the country name column if you have missing values in specified covariates.
trimcovNa: Remove rows with missing values in specified covariate columns
library(trimcovNa)
-Imagine you have a large dataset capturing diverse cases of mpox infections.
-For your analysis, you are specifically interested in studying the association between severity during hospital admission for mpox.
-However, the dataset is extensive, and you want to focus only on observations that allow a detailed examination.
Subset the dataset to include only relevant observations for the admission severity analysis that have no missing values for the following covariates:
“IMMUNOSUPPRESSION”
“SMALLPOX_VACCINE” (vaccination for smallpox)
“MONKEYPOX_VACCINE_1” (number of doses)
“MONKEYPOX_VACCINE” (whether they received the monkeypox vaccine or not)
conflictdata loads with the package
Data to demonstrate the trimun and trimcovNa function
Description: Data for 181 countries from the Uppsala Conflict Data Program and World Bank for the years 2000 to 2019.
The dataset includes various socio-economic indicators.
Data cleanliness is essential for accurate and reliable results in data analysis.
Care should be taken to choose appropriate methods for handling missing data based on the nature of the dataset and the analysis goals.
The process of handling missing data is a key preprocessing step that contributes to the overall data quality and integrity.
A well-cleaned dataset sets the foundation for effective and meaningful insights during the data analysis pipeline.