Skip to content

Commit

Permalink
Formatting, add cores arg
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreenbury committed Sep 11, 2023
1 parent d59ee7b commit 1501cc0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
54 changes: 24 additions & 30 deletions scripts/data_prep/SPC_loadWorkspace_run_1.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# One-time loading
#install.packages("stringr")
#install.packages("tidyverse")
#install.packages("rgdal")

library(parallel)
library(stringr)
library(tidyverse)
Expand All @@ -15,46 +10,45 @@ cores <- detectCores()
source("SPC_functions_run_1.R")

# Lookup
lu <- read.csv(paste(folderInOT,"lookUp-GB.csv", sep = ""))
lu <- read.csv(paste(folderInOT, "lookUp-GB.csv", sep = ""))

# Income related data // Only necessary for England
# ageRescaleFFT <- read.csv(paste(folderInOT,"ageRescaleFFT.csv", sep = ""))
# ageRescaleFPT <- read.csv(paste(folderInOT,"ageRescaleFPT.csv", sep = ""))
# ageRescaleMFT <- read.csv(paste(folderInOT,"ageRescaleMFT.csv", sep = ""))
# ageRescaleMPT <- read.csv(paste(folderInOT,"ageRescaleMPT.csv", sep = ""))
coefFFT <- read.csv(paste(folderInOT,"coefFFT.csv", sep = ""))
coefFPT <- read.csv(paste(folderInOT,"coefFPT.csv", sep = ""))
coefMFT <- read.csv(paste(folderInOT,"coefMFT.csv", sep = ""))
coefMPT <- read.csv(paste(folderInOT,"coefMPT.csv", sep = ""))
meanHoursMFT <- read.csv(paste(folderInOT,"meanHoursMFT.csv", sep = ""))
meanHoursMPT <- read.csv(paste(folderInOT,"meanHoursMPT.csv", sep = ""))
meanHoursFFT <- read.csv(paste(folderInOT,"meanHoursFFT.csv", sep = ""))
meanHoursFPT <- read.csv(paste(folderInOT,"meanHoursFPT.csv", sep = ""))
distribHours <- read.csv(paste(folderInOT,"distribHours.csv", sep = ""))
coefFFT <- read.csv(paste(folderInOT, "coefFFT.csv", sep = ""))
coefFPT <- read.csv(paste(folderInOT, "coefFPT.csv", sep = ""))
coefMFT <- read.csv(paste(folderInOT, "coefMFT.csv", sep = ""))
coefMPT <- read.csv(paste(folderInOT, "coefMPT.csv", sep = ""))
meanHoursMFT <- read.csv(paste(folderInOT, "meanHoursMFT.csv", sep = ""))
meanHoursMPT <- read.csv(paste(folderInOT, "meanHoursMPT.csv", sep = ""))
meanHoursFFT <- read.csv(paste(folderInOT, "meanHoursFFT.csv", sep = ""))
meanHoursFPT <- read.csv(paste(folderInOT, "meanHoursFPT.csv", sep = ""))
distribHours <- read.csv(paste(folderInOT, "distribHours.csv", sep = ""))
distribHoursMFT <- distribHours$MFT
distribHoursMPT <- distribHours$MPT
distribHoursFFT <- distribHours$FFT
distribHoursFPT <- distribHours$FPT

# Health related data
HST <- read.table(paste(folderInOT,"HSComplete.csv",sep = ""), sep=",", header=TRUE)
BMIdiff <- read.table(paste(folderInOT,"BMIdiff.csv",sep = ""), sep=",", header=TRUE)
dMean <- read.table(paste(folderInOT,"BMIdMean.csv",sep = ""), sep=",", header=TRUE)
varData <- c(37.25736,42.28994,37.73406,42.16856,48.20913,44.52134,39.19527,55.90769)
HST <- read.table(paste(folderInOT, "HSComplete.csv", sep = ""), sep = ",", header = TRUE)
BMIdiff <- read.table(paste(folderInOT, "BMIdiff.csv", sep = ""), sep = ",", header = TRUE)
dMean <- read.table(paste(folderInOT, "BMIdMean.csv", sep = ""), sep = ",", header = TRUE)
varData <- c(37.25736, 42.28994, 37.73406, 42.16856, 48.20913, 44.52134, 39.19527, 55.90769)

# NSSEC8
nssecNames<- c("F_16to24","F_25to34","F_35to49","F_50to64","F_65to74",
"M_16to24","M_25to34","M_35to49","M_50to64","M_65to74")
for(i in nssecNames){
assign(paste("NSSEC",i,sep = ""), read.csv(paste(folderInOT,"NSSEC8_EW_",i,"_CLEAN.csv",sep = "")))
nssecNames <- c(
"F_16to24", "F_25to34", "F_35to49", "F_50to64", "F_65to74",
"M_16to24", "M_25to34", "M_35to49", "M_50to64", "M_65to74"
)
for (i in nssecNames) {
assign(paste("NSSEC", i, sep = ""), read.csv(paste(folderInOT, "NSSEC8_EW_", i, "_CLEAN.csv", sep = "")))
}
NSSECS <- read.csv(paste(folderInOT,"NSSECS_CLEAN.csv", sep = ""))
NSSECS <- read.csv(paste(folderInOT, "NSSECS_CLEAN.csv", sep = ""))

# TUS
indivTUS <- read.table(paste(folderInOT,"indivTUS.csv",sep = ""), sep=",", header=TRUE)

#OA coordinates
OACoords <- read.csv(paste(folderInOT,"OACentroids.csv",sep = ""))


indivTUS <- read.table(paste(folderInOT, "indivTUS.csv", sep = ""), sep = ",", header = TRUE)

# OA coordinates
OACoords <- read.csv(paste(folderInOT, "OACentroids.csv", sep = ""))
2 changes: 1 addition & 1 deletion scripts/data_prep/SPC_pipelineLAD_run_1.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ print("adding income data")

region <- unique(lu$RGN20NM[lu$LAD20CD == lad])
if (countryR == "England") {
merge <- addToData(merge, region, coefFFT, coefFPT, coefMFT, coefMPT)
merge <- addToData(merge, region, coefFFT, coefFPT, coefMFT, coefMPT, cores)
} else {
merge$incomeH <- NA
merge$incomeY <- NA
Expand Down

0 comments on commit 1501cc0

Please sign in to comment.