| Data for cleaning | R Documentation |
The data come from clients of a family planning clinic.
For all variables except id: 9, 99, 99.9, 888, 999 represent missing values
data(Planning)
A data frame with 251 observations on the following 11 variables.
IDa numeric vector: ID code
AGEa numeric vector
RELIGa numeric vector: Religion
| 1 | = Buddhist | |
| 2 | = Muslim | |
PEDa numeric vector: Patient's education level
| 1 | = none | |
| 2 | = primary school | |
| 3 | = secondary school | |
| 4 | = high school | |
| 5 | = vocational school | |
| 6 | = university | |
| 7 | = other | |
INCOMEa numeric vector: Monthly income in Thai Baht
| 1 | = nil | |
| 2 | = < 1,000 | |
| 3 | = 1,000-4,999 | |
| 4 | = 5,000-9,999 | |
| 5 | = 10,000 | |
AMa numeric vector: Age at marriage
REASONa numeric vector: Reason for family planning
| 1 | = birth spacing | |
| 2 | = enough children | |
| 3 | = other | |
BPSa numeric vector: systolic blood pressure
BPDa numeric vector: diastolic blood pressure
WTa numeric vector: weight (Kg)
HTa numeric vector: height (cm)
data(Planning) des(Planning) # Change var. name to lowercase names(Planning) <- tolower(names(Planning)) .data <- Planning des(.data) # Check for duplication of 'id' attach(.data) any(duplicated(id)) duplicated(id) id[duplicated(id)] #215 # Which one(s) are missing? setdiff(min(id):max(id), id) # 216 # Correct the wrong on id[duplicated(id)] <- 216 detach(.data) rm(list=ls())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.