Describe how you would use Python or R to clean a dataset containing missing values and inconsistent formatting.