0% found this document useful (0 votes)
2 views2 pages

Discussion Method

The document outlines a case study by Kevin Cloyd Divinagracia addressing various data cleaning methods for specific problems in a dataset. It details techniques used for handling whitespace, text inconsistencies, outliers, missing data, and date formatting. Each method is explained with its purpose and rationale for ensuring accurate data analysis.

Uploaded by

kevudz
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Discussion Method

The document outlines a case study by Kevin Cloyd Divinagracia addressing various data cleaning methods for specific problems in a dataset. It details techniques used for handling whitespace, text inconsistencies, outliers, missing data, and date formatting. Each method is explained with its purpose and rationale for ensuring accurate data analysis.

Uploaded by

kevudz
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

KEVIN CLOYD DIVINAGRACIA

BSCS 3B
CASESTUDY

Discussion of Method
Here is how the code addresses each specific problem identified in your image:
1. P1 (Whitespace and Type):
o Method: I used str_squish() (from the stringr package) to trim
leading/trailing whitespace and [Link]() to convert the text to
numbers.
o Why: The original column was read as character data (text) because of
the spaces. This function forces it into a number format so we can
perform calculations later.
2. P2 & P3 (Text & Categorical Inconsistency):
o Method: I applied str_to_title() to both the "Reported By" and "Priority"
columns.
o Why: This standardizes messy inputs like "BOB", "medium", or "HIGH"
into a consistent "Title Case" format ("Bob", "Medium", "High"),
ensuring categories group together correctly in analysis.
3. P4 (Outlier & Missing Data):
o Method:

 Capping: I used an ifelse statement. If the time was greater


than 180, it was replaced with 180; otherwise, it stayed the
same.
 Imputation: I used replace_na() combined with median().
o Logic: It is crucial to cap the outlier before calculating the median. If
we included the "impossible" 1000-minute value in the median
calculation, it would skew the result.
4. P5 (Date Formatting):
o Method: I used parse_date_time() from the lubridate package with the
argument orders = c("ymd", "mdy").
o Why: The data contained two formats: 2025-03-01 (Year-Month-Day)
and 03/02/2025 (Month/Day/Year). parse_date_time is smart enough to
detect which format a specific row is using and convert them all to a
single standard Date object.

You might also like