# OBJECTIVE 3 AND 4 BASELINE SURVEY IN FIJI - 20 JUNE 2019 to ?? Aug 2019
library (tidyverse)
library (lubridate)
library (stringr)
rm(list = ls())
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/1. raw data")
setwd("Z:/Data Files/Data Files Objective 3")
#############################################
#############################################
## DOWNLOAD ALL FILES ##
#############################################
#############################################
# HOUSE SURVEY
house <- read_csv (file="RISE_baseline_house_FJ_v1.csv")
house.water <- read_csv(file="RISE_baseline_house_FJ_v1-house_survey-water_use-water_repeat.csv")
# HOUSEHOLD SURVEY
hhd <- read_csv (file = "RISE_baseline_hhd_FJ_v1.csv")
hhd.child <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-child_loop.csv")
hhd.activity <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-demographics-activity.csv")
hhd.daycare <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-demographics-daycare.csv")
hhd.ethnicity <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-demographics-ethnicity_screen-ethnicity_repeat.csv")
hhd.marital <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-demographics-marital_status1.csv")
hhd.read <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-demographics-read.csv")
hhd.religion <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-demographics-religion_screen-religion_repeat.csv")
hhd.school <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-demographics-school.csv")
hhd.person <- read_csv (file = "RISE_baseline_hhd_FJ_v1-hhd_survey-person_details1.csv")
#############################################
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data")
setwd("Z:/Data Files/Data Files Objective 3/Summary")
# FIX ALL DATES *****************************
fix_date <- function(x_date){
x_date <- ifelse(!is.na(ymd_hms(x_date)), ymd_hms(x_date),
ifelse(!is.na(dmy_hms(x_date)), dmy_hms(x_date), mdy_hms(x_date))) # Check the format and return the correct integer-date
x_date <- as.POSIXct(x_date, origin = "1970-01-01", tz = "UTC") # Convert the integer-date to a consistent format
}
house$SubmissionDate <- fix_date(house$SubmissionDate)
house$starttime <- fix_date(house$starttime)
house$endtime <- fix_date(house$endtime)
house$time1 <- fix_date(house$time1)
house$time2 <- fix_date(house$time2)
house$time3 <- fix_date(house$time3)
house$time4 <- fix_date(house$time4)
house$time5 <- fix_date(house$time5)
house$time7 <- fix_date(house$time7)
house$time8 <- fix_date(house$time8)
house$time9 <- fix_date(house$time9)
house$time10 <- fix_date(house$time10)
house$today <- ymd (house$today)
hhd$SubmissionDate <- fix_date(hhd$SubmissionDate)
hhd$starttime <- fix_date(hhd$starttime)
hhd$endtime <- fix_date(hhd$endtime)
hhd$time1 <- fix_date(hhd$time1)
hhd$time2 <- fix_date(hhd$time2)
hhd$time3 <- fix_date(hhd$time3)
hhd$time4 <- fix_date(hhd$time4)
hhd$time9 <- fix_date(hhd$time9)
hhd$time10 <- fix_date(hhd$time10)
hhd$time11 <- fix_date(hhd$time11)
hhd$time12 <- fix_date(hhd$time12)
hhd$time13 <- fix_date(hhd$time13)
hhd$time14 <- fix_date(hhd$time14)
hhd$today <- ymd (hhd$today)
hhd.child$time5 <- fix_date(hhd.child$time5)
hhd.child$time6 <- fix_date(hhd.child$time6)
hhd.child$time7 <- fix_date(hhd.child$time7)
hhd.child$time8 <- fix_date(hhd.child$time8)
hhd.person$dob <- dmy (hhd.person$dob)
#check survey duration
test <- house %>%
filter(duration<600) %>% #less than 10 minutes = 21!!
mutate(duration_min = duration/60) %>%
filter (!is.na(survey_status)) %>% #13
select (settlement_barcode, extract_house_no, today, name_surveyor, survey_status, duration_min)
test2 <- hhd %>%
filter(duration<1200) %>% #less than 10 minutes = 21!!
mutate(duration_min = duration/60) %>%
filter (!is.na(survey_status)) %>% #13
select (settlement_barcode, extract_house_no, today, name_surveyor, survey_status, duration_min, gift_yn)
rm(test2, test)
#infill hhd_id with hhd_name - for both house and household surveys
table(is.na(house$hhd_id)) #457
table(!is.na(house$hhd_name)) #776
table(is.na(hhd$hhd_id)) #70
table(!is.na(hhd$hhd_name)) #773
hhd <- hhd %>%
mutate (hhd_id = ifelse(is.na(hhd_id), hhd_name, hhd_id))
house <- house %>%
mutate (hhd_id = ifelse(is.na(hhd_id), hhd_name, hhd_id))
#############################################
## Correct known errors in the data ##
#############################################
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/2. code")
setwd("Z:/R Script/R Script Obj 3")
source("O3_T0_FJ-corrections.R")
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data")
setwd("Z:/Data Files/Data Files Objective 3/Summary")
#############################################
# import consent data - household and child
#############################################
# PULL TOGETHER FINAL LIST OF CONSENTS
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/2b. Consent-in/1. FJ/2. Data/2. code")
setwd("Z:/R Script/R Script Obj 3")
source("consent.update.baseline_FJ.R")
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data")
setwd("Z:/Data Files/Data Files Objective 3/Summary")
# this includes corrections to consent
#############################################
## MERGE SURVEY FILES ##
#############################################
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/2. code")
setwd("Z:/R Script/R Script Obj 3")
source("O3_T0_FJ-merge.R")
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data")
setwd("Z:/Data Files/Data Files Objective 3/Summary")
######################
#problem with age and dob
#has to be corrected after merge, because need ${today} to estimate DOB
######################
#they were given option to enter "age" if they didn't know date of birth
#need to fix/estimate dob
table(!is.na(hhd.merge$age)) #1022 where they entered age instead of dob
hhd.merge <- hhd.merge %>%
mutate (dob_estimate = today - (365 * age)) %>% #estimate dob based on day of survey
rename (person_dob2 = person_dob) %>%
mutate (person_dob = if_else(!is.na(age), dob_estimate, person_dob2)) %>%
select (-person_dob2, -dob_estimate)
#check
check <- hhd.merge %>%
select (age, age_calc, person_dob, today, age_final, age_final2) %>%
mutate (calc_age2 = (today - person_dob)/ 365) %>%
mutate (check = age_final - calc_age2)
rm(check)
##########
### DELETION OF FULL SURVEYS - BEST DONE AFTER MERGE
##########
#KINOYA house # 22 repetition house already done on the 20th form for house and household to be removed.
hhd <- hhd %>%
filter (!(settlement_barcode == "Kinoya" & extract_house_no == 22 & today == "2019-06-24"))
hhd.merge <- hhd.merge %>%
filter (!(settlement_barcode == "Kinoya" & extract_house_no == 22 & today == "2019-06-24"))
house.merge <- house.merge %>%
filter (!(settlement_barcode == "Kinoya" & extract_house_no == 22 & today == "2019-06-24"))
#KINOYA house #67 repetition house and household was done on the 24th but incomplete both redone on the 26 completed. Both house and household done on 24th to be removed.
hhd <- hhd %>%
filter (!(settlement_barcode == "Kinoya" & extract_house_no == 67 & today == "2019-06-24"))
hhd.merge <- hhd.merge %>%
filter (!(settlement_barcode == "Kinoya" & extract_house_no == 67 & today == "2019-06-24"))
house.merge <- house.merge %>%
filter (!(settlement_barcode == "Kinoya" & extract_house_no == 67 & today == "2019-06-24"))
#KOMAVE #40 - duplicate HOUSE surveys - ateca said to delete survey on 18th
house.merge <- house.merge %>%
filter (!(settlement_barcode == "Komave" & extract_house_no == 40 & today == "2019-07-18")) #
#MUANIVATU house # 55 incorrect house number redone correct house # 89 consent done on 02/07/2019. Survey for house and household removed from the 01/07/2019.
hhd <- hhd %>%
filter (!(settlement_barcode == "Muanivatu" & extract_house_no == 55 & today == "2019-07-01"))
hhd.merge <- hhd.merge %>%
filter (!(settlement_barcode == "Muanivatu" & extract_house_no == 55 & today == "2019-07-01"))
house.merge <- house.merge %>%
filter (!(duration == 777 & settlement_barcode == "Muanivatu" & extract_house_no == 55 & today == "2019-07-01"))
#MUANIVATU house # 61 2 house survey on 2nd July to be removed as both house and household was completed on 6th July
house.merge <- house.merge %>%
filter (!(settlement_barcode == "Muanivatu" & extract_house_no == 61 & today == "2019-07-01"))
######
#MATATA house # house #40 incorrect house number redone correct house # 46 consent done on 04/07/2019. Survey for house removed from the 04/07/2019.
house.merge <- house.merge %>%
filter (!(settlement_barcode == "Muanivatu" & extract_house_no == 40 & today == "2019-07-04"))
#WAILEA house # 42 repetition household already done on the 25th form for household to be removed.
hhd <- hhd %>%
filter (!(settlement_barcode == "Wailea" & extract_house_no == 42 & today == "2019-07-30"))
hhd.merge <- hhd.merge %>%
filter (!(settlement_barcode == "Wailea" & extract_house_no == 42 & today == "2019-07-30"))
house.merge <- house.merge %>%
filter (!(settlement_barcode == "Wailea" & extract_house_no == 42 & today == "2019-07-30"))
######
#############################################
## Get household identifiers ##
#############################################
#not needed in Fiji - hhd_id is fine
#############################################
#############################################
## Create variables ##
#############################################
#############################################
# infill age if missing and add current age
table(is.na(hhd.merge$age_final)) #I don't think I need this anymore now I have it fixed in merge
# hhd.merge <- hhd.merge %>%
# mutate (age_final = ifelse(is.na(age_final), ((today - person_dob)/365), age_final)) %>%
# mutate (age_today = (today() - person_dob)/365)
# RECODE
table (hhd.merge$person_gender, exclude = NULL) #hhd entries without person_details -
hhd.merge <- hhd.merge %>%
mutate (person_gender = recode (person_gender, '0' = "female", '1' = "male", 'female' = "female", 'male' = "male",'-77' = "other",
'-99' = "don't know", '-88' = "refused to answer",
'-66' = "question not asked"))
table (hhd.merge$person_gender, exclude = NULL) #hhd entries without person_details - 3
table ((hhd.merge$person_gender), hhd.merge$respondent_yn, exclude = NULL) #all 3 na
#3 with no gender - these were "not_home" surveys I think
#get list of households with a fridge for Pete F (14 Aug 2019)
# items_list_lbl 8 8. Refrigerator
fridge <- hhd %>%
select (settlement_barcode, extract_house_no, hhd_id, items_list_8) %>%
filter (items_list_8==1)
#############################################
## generate person ids ##
#############################################
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/2. code")
setwd("Z:/R Script/R Script Obj 3")
source("O3_T0_FJ-person_list.R")
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data")
setwd("Z:/Data Files/Data Files Objective 3/Summary")
# this feeds into R script that generates person_ids
#this was run on xxxxxx and won't be run again
# FJ_2019xx_O3_4_participants_list.R
#############################################
## create files for use in next survey ##
#############################################
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/2. code")
# source("O3_T0_FJ-data_output.R") #ONLY DONE FOR CHILD SAMPLING; NEED TO DO create files for 6-MONTHLY SURVEY
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/")
# data file: person_list_FJ_201908.csv saved in this script**
#NOTES:
# What we have at the end of the baseline survey:
#1) there are 67 household consents with no baseline data (my plan is to leave the households on the list in case they decide to participate at next survey)
#2) there are 139 children in the baseline survey with no child consent form signed
# I have built the child consent into the next survey
# you will need to make sure the field team are aware that child sampling consent will be an important part of the next survey
#3) there are 50 child consents with no baseline data
# based on the information Ateca was able to obtain, it seems most likely that these children have moved out of the settlement
# my plan is to remove them from the list of people living in the settlement
#############################################
## create data files for users / analysis ##
#############################################
# setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/2. code")
# # source("O3_T0_ID-data_extract.R") # not done yet
# setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data")
#############################################
## RUN REPORTS ##
#############################################
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data/2. code")
setwd("Z:/R Script/R Script Obj 3")
source("O3_T0_FJ-data_report.R")
#setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/RISE/4. Surveys/3. Objectives/1. FJ/3/20190624_baseline/3. Data")
setwd("Z:/Data Files/Data Files Objective 3/Summary")
#checking respondents
respond_house <- house.merge %>%
select (settlement_barcode, extract_house_no, hhd_id, hhd_name, home_yn, respondent_house)
respond_hhd <- hhd %>%
select (settlement_barcode, extract_house_no, hhd_id, house_status, respondent1a,
respondent1b, respondent1c, survey_continue_yes, adult_respondent_name)
respond_child <- hhd.merge %>%
select (settlement_barcode, extract_house_no, hhd_id, caregiver_present,
respondent_yn, caregiver_a, caregiver_related)
#not sure if I will use the code below..........
#############################################
#############################################
## CHECK CONSENTS ##
#############################################
#############################################
# # 1. CHECK THAT THERE IS A CONSENT FOR EACH HOUSE SURVEY
# # identify a started house survey by !is.na(tenure1) - this means someone was home and they made it through some of the questions
table (house.merge$tenure1, exclude = NULL) #95 NA's
table (house.merge$house_status, house.merge$tenure1, exclude = NULL)
#all tenure NA are "not_home" - good
table (house.merge$respondent_house, house.merge$home_yn, exclude = NULL)
table (house.merge$tenure1,house.merge$household_share, exclude = NULL)
#
house.survey.check <- house.merge %>%
filter (!is.na(tenure1)) %>% #only surveys that have responses
select (today, settlement_barcode, extract_house_no, hhd_id, house_status,
new_consent_yn, consent_prev_no, consent_new_complete, consent_prev_yes,
respondent_house, home_yn,survey_status) %>%
rename (settlement = settlement_barcode,
house.no = extract_house_no) %>% #110
unique() #to get one entry per house (remove dups from water loop)
# # merge with consent list to check consented
house_consent_check <- full_join (consent_list_all, house.survey.check,
by = c("settlement" = "settlement",
"house.no" = "house.no",
"hhd_id" = "hhd_id"))
rm(house.survey.check)
#look manually****************
#to identify errors in consent matching:
x <- house_consent_check %>%
filter (!is.na(today), is.na(date),
(respondent_house == 1 | home_yn == 1))
table (x$settlement, x$house.no)
rm(x)
# # 2. CHECK THAT THERE IS A CONSENT FOR EACH HOUSEHOLD SURVEY
# #hhd survey started identified by !is.na(gift_yn)
table (hhd$gift_yn, exclude = NULL) #0 none with NA
hhd.survey.check <- hhd %>%
filter (!is.na(gift_yn)) %>%
select (today, settlement_barcode, extract_house_no, hhd_id, house_status, hhd_outstanding,
gift_yn, survey_status) %>%
rename (settlement = settlement_barcode, house.no = extract_house_no) %>%
unique() #282
# merge with consent list to check consented
hhd_consent_check <- full_join (consent_list_all, hhd.survey.check,
by = c("settlement" = "settlement",
"house.no" = "house.no",
"hhd_id" = "hhd_id"))
rm(hhd.survey.check)
#look manually****************
#to identify errors in consent matching:
x <- hhd_consent_check %>%
filter (!is.na(today), is.na(date))
table (x$settlement, x$house.no)
rm(x)
#
# # 5. COMPARE WITH CONSENT LIST - WHAT HOUSES WERE MISSED?
# merge house and household surveys with consent data
all_consent_check <- full_join (house_consent_check, hhd_consent_check,
by = c("settlement" = "settlement",
"house.no" = "house.no",
"hhd_id" = "hhd_id",
"signed.yn" = "signed.yn",
"study" = "study",
"surveys" = "surveys",
"date" = "date")) %>%
select (-new_consent_yn, -consent_prev_no, -consent_new_complete, -consent_prev_yes) %>%
rename(house.survey = house_status.x,
hhd.survey = house_status.y)
#house with no house survey
no.survey <- all_consent_check %>%
group_by(settlement, house.no) %>%
mutate (house.survey_y = max(house.survey, na.rm=TRUE)) %>%
filter (is.na(today.x) | is.na(today.y)) %>%
filter (is.na(house.survey_y)) %>% #54 still not surveyed
filter (!is.na(signed.yn)) #50
no.survey.comm <- no.survey %>%
group_by(settlement) %>%
summarize (count = n())
#houses on consent list that haven't been visited
# merge house and household surveys with consent data
#include all visits, not just completed surveys
#house survey
a <- house.merge %>%
select (today, settlement_barcode, extract_house_no, hhd_id, house_status,
new_consent_yn, consent_prev_no, consent_new_complete, consent_prev_yes,
respondent_house, home_yn,survey_status) %>%
rename (settlement = settlement_barcode,
house.no = extract_house_no) %>% #
unique() #to get one entry per house (remove dups from water loop)=902
#hhd survey
b <- hhd %>%
select (today, settlement_barcode, extract_house_no, hhd_id, house_status, hhd_outstanding,
survey_status) %>%
rename (settlement = settlement_barcode, house.no = extract_house_no) %>%
unique() #646
#combine
c <- bind_rows(a, b) %>% #1548
select (settlement, house.no, hhd_id) %>%
unique() %>% #808
mutate (visit = "yes")
#merge with consent data
d <- full_join (consent_list_all, c,
by = c("settlement" = "settlement",
"house.no" = "house.no",
"hhd_id" = "hhd_id")) %>% #984
group_by(settlement, house.no) %>%
mutate (count = n())
#only those that have not been visited
e <- d %>%
filter (is.na(visit) & count == 1)
table(e$settlement) #- actually only 2
rm(a, b, c, d, e)
# # 6. FOR INCOMPLETE SURVEYS - HOW MANY VISITS?
#
#
# ##############################################################
# ##############################################################
# ##############################################################
# # BY SETTLEMENT
# #
# #
# # ###########################
# # ###########################
# # ***loop through all settlements
# settlements <- c("Kg Lempangang", "Kawasan Untia", "Kg Nelayan, Barombong", "Kg Bonelengga",
# "Kg Tunas Jaya", "Jl Barawaja 2, Pampang", "Kg Cedde","Kg Gampangcayya, Tallo",
# "Kg Bambu-Bambu, Jl Birta", "Kg Baru, Antang", "Jl Borong Raya Baru", "Kg Alla-Alla")
#
# for (i in seq_along(settlements)) {
#
# #1. list of all houses and heads of household and consents
# a <- house_consent_check %>%
# filter (settlement == settlements[i]) %>%
# select (house.no, hhd.head, signed.yn, study, surveys)
# b <- hhd_consent_check %>%
# filter (settlement == settlements[i]) %>%
# select (house.no, hhd.head, signed.yn, study, surveys)
# list <- rbind (a,b)
# nrow(list)
# list <- unique(list)
# nrow(list)
# rm(a,b)
#
# #2. total # visits to house
# a <- house_consent_check %>%
# filter (settlement == settlements[i]) %>%
# select (house.no, hhd.head, today) %>%
# mutate (visit = ifelse(is.na(today), 0, 1)) %>%
# filter (visit !=0)
# b <- hhd_consent_check %>%
# filter (settlement == settlements[i]) %>%
# select (house.no, hhd.head, today) %>%
# mutate (visit = ifelse(is.na(today), 0, 1)) %>%
# filter (visit !=0)
# visits <- rbind (a,b)
# nrow(visits)
# visits <- unique (visits) #to get to one visit per day
# nrow(visits)
# visits <- visits %>%
# group_by (house.no) %>%
# summarise (no.visits = sum (visit))
# rm(a,b)
#
# # 3. house survey completed?
# house.i <- house_consent_check %>%
# filter (settlement == settlements[i]) %>%
# select (house.no, hhd.head, survey_status, today) %>%
# rename (house.survey.yn = survey_status, house.survey.date = today) %>%
# arrange (house.no, hhd.head, house.survey.yn, house.survey.date) %>%
# filter (!is.na(house.survey.yn))
# a <- house.i %>% # check that no duplicates
# select (house.no)
# b <- duplicated (a)
# table(b)
# rm(a,b) #no duplicates!
#
# #4. hhd survey completed?
# hhd.i <- hhd_consent_check %>%
# filter (settlement == settlements[i]) %>%
# select (house.no, hhd.head, survey_status, today) %>%
# rename (hhd.survey.yn = survey_status, hhd.survey.date = today) %>%
# arrange (house.no, hhd.head, hhd.survey.yn, hhd.survey.date) %>%
# filter (!is.na(hhd.survey.yn))
# a <- hhd.i %>% # check that no duplicates
# select (house.no, hhd.head)
# b <- duplicated (a)
# table(b)
# rm(a,b) #no duplicates
#
#
# #join house-level data
# i1 <- full_join(visits, house.i, by = c("house.no" = "house.no"))
#
# # join hhd-level data - list
# i2 <- full_join(list, hhd.i, by = c("house.no" = "house.no",
# "hhd.head" = "hhd.head"))
# # remove those with no consent data and no hhd survey visit
# i3 <- i2 %>%
# filter (!is.na(signed.yn) | (!is.na(hhd.survey.yn) | !is.na(hhd.survey.date)) )
#
# I <- full_join(i3, i1, by = c("house.no" = "house.no",
# "hhd.head" = "hhd.head")) %>%
# select (house.no, hhd.head, signed.yn, study, surveys, no.visits,
# house.survey.yn, house.survey.date, hhd.survey.yn, hhd.survey.date) %>%
# arrange (house.no, hhd.head)
#
# # setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/Current/RISE/4. Surveys/3. Objectives/3/20181112_Baseline/2. ID/2. Data/3. analysis")
# folder <- "S:/R-MNHS-SPHPM-EPM-IDEpi/Current/RISE/4. Surveys/3. Objectives/3/20181112_Baseline/2. ID/2. Data/3. analysis"
# # write_csv(I, path = "S:/R-MNHS-SPHPM-EPM-IDEpi/Current/RISE/4. Surveys/3. Objectives/3/20181112_Baseline/2. ID/2. Data/3. analysis/i.csv")
# # write_csv (I, path = paste0(folder, "/", settlements[i], ".csv"))
# setwd("S:/R-MNHS-SPHPM-EPM-IDEpi/Current/RISE/4. Surveys/3. Objectives/3/20181112_Baseline/2. ID/2. Data/3. analysis")
# # save(I, file = paste0(settlements[i], ".RData"))
#
# # *******************
# #also fixing household name - generate table for CFW to check
# # *******************
# # names from hhd survey
# # names <- hhd.merge %>%
# # filter (settlement_barcode == settlements[i]) %>%
# # select (extract_house_no, hhd_name, person_name, person_name_last, person_relationship, adult_respondent_name) %>%
# # rename (house.no = extract_house_no, hhd.head = hhd_name) %>%
# # arrange (house.no, hhd.head) %>%
# # filter (person_relationship == 1) %>%
# # select (-person_relationship)
# # #join
# # names_check <- full_join(list, names, by = c("house.no" = "house.no",
# # "hhd.head" = "hhd.head"))
# # # remove those with no names
# # names_check <- names_check %>%
# # filter (!(is.na(hhd.head) & is.na(person_name))) %>%
# # arrange (house.no, hhd.head)
# #
# # write_csv (names_check, path = paste0(folder, "/", settlements[i], "_names.csv"))
# # }
#
#
# rm(list, visits, house.i, hhd.i, i1, i2, i3, I, names_check, names, folder, i, settlements)
#
#
#
#
#
#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.