diff --git a/dictionaries.R b/dictionaries.R new file mode 100644 index 0000000000000000000000000000000000000000..ad3611c4b13436d7a5849fea5464b646ef077e43 --- /dev/null +++ b/dictionaries.R @@ -0,0 +1,147 @@ +# Dictionaries for use in labelling variables +# Sourced from .RProfile on project load + +# time use diary labels ---- +projParams$tp1DiaryLabelsQ1A <- c("Sleep", + "Wash/dress/care for self", + "Eating", + "Paid work", + "Study/schooling", + "Food preparation/ cooking", + "Set table, wash or put away dishes", + "Cleaning", + "Laundry, ironing, clothing repair", + "Home/vehicle maintenance or improvement", + "Other domestic work", + "Purchase/consume goods & services", + "Pet care (not walk dog)", + "Physical, medical child care", + "Child care/teach", + "Supervise, accompany, other child care", + "Adult care", + "Out of home civic/leisure/sport/religious/voluntary activities / dog walking", + "Eat/drink out", + "General sport or exercise", + "Receive or visit friends", + "Conversation (in person, phone, write letters)", + "Indoor leisure/hobbies/games", + "Relax, think, do nothing", + "Read", + "In-home leisure (audio)", + "Indoor leisure (TV, PC games, internet use)", + "Travel to or from work/school/hobbies etc", + "Plug in device to charge", + "None") + +projParams$tp1DiaryLabelsQ2A <- c("Shower", + "Bath", + "Other", + "Dress", + "Involving cooking (hob, oven, toaster, microwave, kettle)", + "Involving no cooking at all", + "Hand-washing", + "Stack dishwasher", + "Using dishwasher", + "Power-assisted (e.g. Vacuum)", + "Manual (e.g. dustpan and brush, mop)", + "Sorting or loading washing", + "Laundry by hand", + "Laundry by machine", + "Tumble drying", + "Ironing", + "Other_2", + "Powered tools", + "Manual/unpowered tools ONLY", + "Wash/bath child", + "Other physical child care", + "Receive friends", + "Visit friends") + +projParams$tp1DiaryLabelsQ3 <- c("Own home", + "Another's home", + "Workplace/ School", + "Service or shop", + "Restaurant/ Café", + "Travelling", + "Other locations") + +# survey mode labels ---- +# to use:- df$col <- plyr::revalue(df$col, projParams$namesSurveyMode)] + +projParams$namesSurveyMode <- + c("Install_CATI" = "CATI" , + "Install_CAWI" = "CAWI", + "Install_f2f" = "Face-to-Face", + "No data" = "No survey data") + +# dwelling type ---- +# to use:- df$col <- plyr::revalue(df$col, projParams$namesDwellingType)] + +projParams$namesDwellingType <- + c("Detached" = "Detached", + "Semi-detached" = "Semi", + "Terrace or end terrace" = "Terrace", + "Flat" = "Flat/Other", + "Commercial" = "Flat/Other", + "Caravan etc" = "Flat/Other", + "Refused" = "Flat/Other") + +# TP3 intervention groups ---- + +projParams$namesGroupsTP3 <- c( + "BMG Group 1: Control" = "1: None", + "BMG Group 2" = "2: Data informed", + "BMG Group 3" = "3: Time-of-use rebate, opt-in", + "BMG Group 4" = "4: Time-of-use rebate, opt-out") + +projParams$namesGroupsTP3x <- c( + "TG1" = "1: None", + "TG2" = "2: Data informed", + "TG3" = "3: Time-of-use rebate, opt-in", + "TG4" = "4: Time-of-use rebate, opt-out") + +# TP2 intervention groups ---- + +projParams$namesGroupsTP2 <- c( + "BMG Group 1: Control" = "1: None", + "BMG Group 2" = "2: LED upgrades", + "BMG Group 3" = "3: Data informed & £", + "BMG Group 4" = "4: Data informed") + +projParams$namesGroupsTP2x <- c( + "TG1" = "1: None", + "TG2" = "2: LED upgrades", + "TG3" = "3: Data informed & £", + "TG4" = "4: Data informed") + +projParams$namesGroupsTGs <- c( + "BMG Group 1: Control" = "TG1", + "BMG Group 2" = "TG2", + "BMG Group 3" = "TG3", + "BMG Group 4" = "TG4") + +# TP1 intervention groups (event day) ---- +# to use:- df$col <- plyr::revalue(df$col, namesGroupsTP1)] + +projParams$namesGroupsTP1 <- c( + "BMG Group 1: Control" = "1: None", + "BMG Group 2" = "2: Online msg + loop", #consumer engagement through online + "BMG Group 3" = "3: Online & postal msg + loop + £", #consumer engagement through email & postal communications & loop notifications & £ + "BMG Group 4" = "4: Postal msg, no event day") #consumer engagement through postal communications, no event day + + +projParams$namesGroupsTP1x <- c( + "TG1" = "1: None", + "TG2" = "2: Online msg + loop", #consumer engagement through online + "TG3" = "3: Online & postal msg + loop + £", #consumer engagement through email & postal communications & loop notifications & £ + "TG4" = "4: Postal msg, no event day") #consumer engagement through postal communications, no event day + + +# Abbreviated intervention groups for CustType profile generation ---- +# to use:- df$col <- plyr::revalue(df$col, namesGroupsCustType)] + +projParams$namesGroupsCustType <- c( + "BMG Group 1: Control" = "TG1", + "BMG Group 2" = "TG2", + "BMG Group 3" = "TG3", + "BMG Group 4" = "TG4") diff --git a/projParams.R b/projParams.R new file mode 100644 index 0000000000000000000000000000000000000000..5691ddb3f4fe3390fd31cbcfdf2c4fe1927d1ae8 --- /dev/null +++ b/projParams.R @@ -0,0 +1,81 @@ +# Set global parameters ---- + +# Load libraries needed in this file (only) +require(here) # require so this fails if it's absent + +# Where are we & who are we? ---- +projParams$sysInfo <- Sys.info() +projParams$sysName <- projParams$sysInfo[[1]] +projParams$nodeName <- projParams$sysInfo[[4]] +projParams$userName <- projParams$sysInfo[[7]] + +# Proj location +projParams$projLoc <- here::here() + +# Key dates ---- +projParams$projStart <- as.Date("2016-09-01") +# trial period 1 +projParams$tp1Start <- as.Date("2017-01-02") # inclusive - start on the Monday after New Year +projParams$tp1eventDay <- as.Date("2017-03-15") +projParams$tp1End <- as.Date("2017-04-09") # inclusive - run up to final Sunday after Event day vouchers posted (see https://sotonac-my.sharepoint.com/personal/ba1e12_soton_ac_uk/Documents/Projects/LCNF_SAVE/SAVE_shared/WP4-Recruitment,%20Surveys%20and%20Trials/Trial1Analysis/TP1InterventionTimeline.xlsx) +# trial period 2 +projParams$tp2_1Start <- as.Date("2017-10-02") # inclusive - although engagement messages sent in September +projParams$tp2_1End <- as.Date("2017-12-17") +# trial period 3? +# end +projParams$tpprojEnd <- as.Date("2018-06-30") + +projParams$challenge1Start <- as.Date("2017-11-20") # peak each day for the whole week w/c 20 Nov - compare to previous 5 full weeks +projParams$challenge1End <- as.Date("2017-11-24") # inclusive (weekdays only) +projParams$challenge2Start <- as.Date("2018-01-29") # peak each day for the whole week w/c 29 Jan +projParams$challenge2End <- as.Date("2018-02-02") # inclusive (weekdays only) +projParams$challenge3Start <- as.Date("2018-02-06") # peak on 6 and 7 Feb - compare to previous 5 Tue/Wed or previous 5 weeks of weekday consumption +projParams$challenge3End <- as.Date("2018-02-07") # inclusive (weekdays only) +projParams$challenge4 <- as.Date("2018-03-21") # peak on 21 Mar - compare to previous 5 Wed or previous 5 weeks of weekday consumption + +# Data paths ---- +# Alternative to storing paths for individual items, in future use lists: +# ----- e.g. filePaths <- list(dPath = "J:/CivilEnvResearch/Public/SERG/SAVE/data/", ...) + +# Overall data path ---- +projParams$uosDataPath <- "J:/CivilEnvResearch/Public/SERG/SAVE/data/" # J Drive archive +projParams$dPath <- projParams$uosDataPath #default + +# Includes ---- + +# Data path ---- + +# XX edit this according to platform/location/user XX + +if(startsWith(projParams$userName, "ben")) # => BA laptop + projParams$dPath <- "~/Data/SAVE/" + +if(startsWith(projParams$userName, "twr")) # => TWR laptop + projParams$dPath <- "/Volumes/Resource/CivilEnvResearch/Public/SERG/SAVE/data/" + +if(startsWith(projParams$nodeName, "octomac")) # => BA laptop + projParams$dPath <- "~/Data/SAVE/" + +if(startsWith(projParams$sysName, "Linux")) # => probably HPC but beware UoS RStudio server (see below) + projParams$dPath <- "~/Data/SAVE/" + +if(startsWith(projParams$nodeName, "indigo01")) # => HPC interactive node + projParams$dPath <- "~/Data/SAVE/" + +if(startsWith(projParams$nodeName, "srv02405")) # => UoS RStudio server (fixed 19/3/2019 after it moved) + projParams$dPath <- "/mnt/SERG_SAVE_data/" + +# if(nodeName == "serg-rstudio-server" & userName == "mh8g10") # => Mikey's Server +# dPath <- "~/mnt/CivilEnvResearch/Public/SERG/SAVE/data/" + +# set to the UKDA data package +projParams$ukdaDataPath <- paste0(projParams$dPath, "processed/ukdaArchive/") + +# Misc settings ---- +# > bytes converter ---- +projParams$bytesToMbytes <- 1048576 + + + + +