Skip to content

Commit cb4a8b9

Browse files
committed
Helper functions
1 parent ab2d137 commit cb4a8b9

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

functions.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@ library(httr)
66
library(jsonlite)
77
library(xml2)
88

9-
#Helper functions
9+
#HELPER FUNCTIONS
10+
#reduce need to type glimpse every time...
1011
g <- function(x) glimpse(x)
12+
v <- function(x) View(x)
1113

14+
#Wrap grepl to do tidier version of this when e.g. filtering for terms
15+
#gq = "grepl quick!"
16+
qg <- function(...) grepl(..., ignore.case = T)
1217

1318
#OSM postcode fetch
1419
get_fulladdress_from_osm <- function(business_name, place_name, quotebusiness = F) {

testcode/tests_n_checks_companieshousedata.R

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,24 @@ both <- both %>% filter(SIC_5DIGIT_CODE!="99999")
178178
#Let's make map of manufacturing
179179
if (!dir.exists('local/qgis')) dir.create('local/qgis')
180180

181-
st_write('local/')
181+
st_write(
182+
both %>% filter(SIC_SECTION_NAME == 'Manufacturing') %>% select(localauthority_name,Employees_thisyear),
183+
'local/qgis/livelist_manuf_section.geojson')
184+
185+
st_write(
186+
both %>% filter(qg('information',SIC_SECTION_NAME)) %>% select(localauthority_name,Employees_thisyear),
187+
'local/qgis/livelist_ICT_section.geojson')
188+
189+
st_write(
190+
both %>% filter(qg('agri',SIC_SECTION_NAME)) %>% select(localauthority_name,Employees_thisyear),
191+
'local/qgis/livelist_ICT_section.geojson')
192+
193+
194+
195+
196+
197+
198+
182199

183200

184201

0 commit comments

Comments
 (0)