knitr::opts_chunk$set(echo = TRUE)
library(tidyverse) library(disperseR)
In this vignette we show you how we prepared the zip code coordinate data that we have attached to the disperseR
package.
In case you have not yet created your project folder use the following command.
disperseR::create_dirs()
We first download the data from Open Data Soft
filename <- file.path(main_dir, 'zipcodecoordinate.csv') url <- 'https://public.opendatasoft.com/explore/dataset/us-zip-code-latitude-and-longitude/download/?format=csv&timezone=Europe/Berlin&use_labels_for_header=true' if(!file.exists(filename)){ download.file(url = url, destfile = filename) }
Read in the file.
zipcodecoordinate <- read.csv(filename, skip = 0, header = T, sep=";")
Select columns and rename them.
zipcodecoordinate <- zipcodecoordinate %>% dplyr::select(Zip, City, Latitude, Longitude) %>% dplyr::rename(ZIP=Zip)
Now the data set is ready to use in your plots! We added it to this package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.