Skip to content
Snippets Groups Projects
Commit b7ffb02c authored by Ben Anderson's avatar Ben Anderson
Browse files

added snippets

parent 2e7e3617
No related branches found
No related tags found
No related merge requests found
......@@ -67,45 +67,6 @@ with(cerResPreSurveyDT,
table(baCompletedPreSurvey,question200pleaserecordsexf, useNA = "always")
)
# create heating variable
cerResPreSurveyDT$baHeat <- ifelse(cerResPreSurveyDT$question470whichofthefollow == 1,
"Electricity_storage",
NA)
cerResPreSurveyDT$baHeat <- ifelse(cerResPreSurveyDT$aq == 1,
"Electricity_plug_in",
cerResPreSurveyDT$baHeat)
cerResPreSurveyDT$baHeat <- ifelse(cerResPreSurveyDT$ar == 1,
"Gas",
cerResPreSurveyDT$baHeat)
cerResPreSurveyDT$baHeat <- ifelse(cerResPreSurveyDT$as == 1,
"Oil",
cerResPreSurveyDT$baHeat)
cerResPreSurveyDT$baHeat <- ifelse(cerResPreSurveyDT$at == 1,
"Solid_fuels",
cerResPreSurveyDT$baHeat)
cerResPreSurveyDT$baHeat <- ifelse(cerResPreSurveyDT$au == 1,
"Renewables",
cerResPreSurveyDT$baHeat)
cerResPreSurveyDT$baHeat <- ifelse(cerResPreSurveyDT$av == 1,
"Other",
cerResPreSurveyDT$baHeat)
# create number of people variable
cerResPreSurveyDT$baNpeople[cerResPreSurveyDT$question410whatbestdescribes == 1] <- "1"
cerResPreSurveyDT$baNpeople[cerResPreSurveyDT$question420howmanypeopleove == 1] <- "2"
cerResPreSurveyDT$baNpeople[cerResPreSurveyDT$question420howmanypeopleove == 2] <- "3"
cerResPreSurveyDT$baNpeople[cerResPreSurveyDT$question420howmanypeopleove == 3] <- "4"
cerResPreSurveyDT$baNpeople[cerResPreSurveyDT$question420howmanypeopleove >= 4] <- "5+"
with(cerResPreSurveyDT,
table(baNpeople,baCompletedPreSurvey)
)
# create a small subset of the pre trial survey
cerResPreSurveyDTred <- cerResPreSurveyDT[,.(ID,
baCompletedPreSurvey,
baHeat,
baNpeople)]
# load post-trial survey
cerResPostSurvey <- paste0(
cerPath,dPath,"Smart meters Residential post-trial survey data.dta"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment