#Importing the clinic file
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(knitr)
clinic <- read.csv("clinic.csv", header=TRUE)
clinic_cleaned <- clinic[, c("pid", "sex", "site", "enrollment_age", "enrollment_weight", "enrollment_date", "discharge_age", "discharge_weight", "discharge_date", "staffmember")] %>%
filter(discharge_weight <= 25, discharge_weight > 0, enrollment_weight <= 15, enrollment_weight > 0)
#Importing the household file
household <- read.csv("household.csv", header=TRUE)
household_cleaned <- household[, c("pid", "c_sex", "todate", "weight")]
write.csv(clinic_cleaned, "cleaned_clinic.csv", row.names = FALSE)
write.csv(household_cleaned, "cleaned_household.csv", row.names = FALSE)