Updating the geometry files for localcovid19now
is
important for when a country changes its borders, a better resolution
file is available, a new country is being added to the package, and to
correct existing errors.
Currently, updating country geometries is only intended to be done in
interactive mode. This tutorial assumes use of a “Project” in RStudio,
while it may be doable outside this environment. The process requires
loading devtools
.
Open a Project in RStudio, preferably a git-enabled project connected to the localcovid19now github repo or a fork.
Write a “process script” for the countries you want to update/add to the package. This can be done through either manually writing a new script or using the included “snippet.”
(Optional) Install the snippet.
Open geomTemplate.snippets
and copy the contents. In
RStudio, go to Tools > Global Options > Code > Edit Snippets.
Paste the contents of geomTemplate.snippets
to the bottom
of the “edit snippets” page. Make sure all indents are done using “tab”
(they will automatically be highlighted red if not).
Open a new script and type geomTemplate
and then
“shift+tab” if it did not autocomplete. If you did not install the
snippet, use a previous example from
tools/processed
.
Fill in the blanks. While you may run the code to make sure it works, you should not save any outputs.
m49
data set from the package to check if the
country names match in the reference data set.Save the file as
tools/toProcess/process[CountryName].R
using lower camel
case.
Run library(localcovid19now); library(devtools)
.
Run updateGlobal()
. This function will add the new
geometries to the existing ones and save all changed geometries to the
data
folder for use in Load[Country]
functions.
Make sure that the Load[Country]
function for the new
countries uses the correct column names in the newly-created geometry
files.