Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
DECC-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Anderson
DECC-data
Commits
e0be4894
Commit
e0be4894
authored
9 years ago
by
Ben Anderson
Browse files
Options
Downloads
Patches
Plain Diff
added project
parent
f94c500b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DECC.Rproj
+13
-0
13 additions, 0 deletions
DECC.Rproj
LSOA-Domestic/process_DECC_LSOA_2011.R
+78
-0
78 additions, 0 deletions
LSOA-Domestic/process_DECC_LSOA_2011.R
with
91 additions
and
0 deletions
DECC.Rproj
0 → 100644
+
13
−
0
View file @
e0be4894
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
This diff is collapsed.
Click to expand it.
LSOA-Domestic/process_DECC_LSOA_2011.R
0 → 100644
+
78
−
0
View file @
e0be4894
#########################################
#* Script to:
# * - Extract data from DECC LSOA level domestic energy consumption data
# (https://www.gov.uk/government/collections/mlsoa-and-llsoa-electricity-and-gas-estimates)
#
# Copyright (C) 2014-2015 University of Southampton
#
# Author: Ben Anderson (b.anderson@soton.ac.uk, @dataknut, https://github.com/dataknut)
# [Energy & Climate Change, Faculty of Engineering & Environment, University of Southampton]
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License
# (http://choosealicense.com/licenses/gpl-2.0/), or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# YMMV - http://en.wiktionary.org/wiki/YMMV
######################################
# Housekeeping ----
# clear the workspace
rm
(
list
=
ls
())
# libraries
library
(
data.table
)
library
(
xlsx
)
# just to check where R thinks we are
getwd
()
# data path
dpath
<-
"~/Documents/Work/Data/DECC/LSOA Energy Data/2011/"
# census path
cpath
<-
"~/Documents/Work/Data/UK Census/2011Data/EW/lsoa/processed/"
efile
<-
paste0
(
dpath
,
"Lower_Layer_Super_Output_Area__LSOA__domestic_electricity_estimates_2011_All_data.csv"
)
# electricity file
gfile
<-
paste0
(
dpath
,
"Lower_layer_Super_Output_Area__LSOA__domestic_gas_estimates_2011_Look-up_spreadsheets.xlsx"
)
# Load data ----
# first row contains variable names
lsoaElec2011_DT
<-
fread
(
efile
,
header
=
TRUE
,
col.names
=
c
(
"lan"
,
"lac"
,
"mlsoa"
,
"lsoa"
,
"kWh_ord"
,
"kWh_e7"
,
"kWh_tot"
,
"nmeters_ord"
,
"nmeters_e7"
,
"nmeters_tot"
,
"meankWh_ord"
,
"meankWh_e7"
,
"meankWh_tot"
)
)
# Gas data is not as easy to process as each GOR is in a different tab
# and also there are some rows which are for multiple LSOAs due to potential
# disclosure issues
#lsoaGas2011_DT <- as.data.table(
# read.xlsx(gfile, sheetName = ""XXXXX", 1)
#)
head
(
lsoaElec2011_DT
)
# set join key
lsoaElec2011_DT
$
zonecode
<-
lsoaElec2011_DT
$
lsoa
setkey
(
lsoaElec2011_DT
,
zonecode
)
# Load Census data ----
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment