Description Usage Arguments Value Note Author(s) Examples
Compile/convert unzipped OS Code-Point(R) Open data into a form that I want.
Assumes you have downloaded and unzipped ‘codepo_gb.zip’ to ‘path’.
Alternatively, saves the output as an .rds file for subsequent re-loading.
1 2 3 4 5 6 7 8 9 | getCodePoint( path,
doc.folder = paste(path, "Doc", sep = "/"),
csv.folder = paste(path, "Data/CSV", sep = "/"),
headers.we.want = c("Admin_county_code", "Admin_district_code"),
index.of.header.to.join = 2,
rds.output.folder = path,
get.RDS.instead = FALSE )
getCodePointRDS( path, ... )
|
path |
the path where the unzipped codepoint files are |
doc.folder |
the path of the ‘Doc’ sub-folder |
csv.folder |
the path of the ‘CSV’ sub-folder |
headers.we.want |
a list of the headers to keep (apart from the mandatory headers, the rest are discarded). Available headers are Mandatory headers are |
index.of.header.to.join |
which header (in |
rds.output.folder |
where save the output as an .rds file, for faster re-loading in the future. This identifies the version from ‘metadata.txt’ and names the .rds file accordingly. |
get.RDS.instead |
return the full path of the RDS file that is saved instead of returning the data frame |
Depending on get.RDS.instead
TRUE |
Returns a data frame consisting of the Code-Point csv files (all appended to each other), joined to the information in ‘Codelist.xls’ (which is the names related to the codes) |
FALSE |
Saves the data frame to a |
getCodePointRDS
is a wrapper function for getCodePoint
that specifies get.RDS.instead = TRUE
.
This takes about 15 - 20 seconds on my computer. Please be patient.
Wei Liang Yap
1 2 3 4 5 6 | # do it
CodePoint <- getCodePoint( "H:/DATASETS/OS/CodePoint/tmp" )
# re-load the saved .rds file
filename <- getCodePointRDS( "H:/DATASETS/OS/CodePoint/tmp",rds.output.folder="H:/DATASETS/OS/CodePoint" )
CodePoint2 <- readRDS(filename)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.