<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/creating-a-mailing-list-in-qgis-and-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://realdataweb.wordpress.com/2017/02/15/creating-a-mailing-list-in-qgis-and-r/"> R – Real Data</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>My day job as a real estate agent requires a myriad of skills, ranging from accounting to negotiation to business analysis.  Frequently (about every three months) I whip out my marketing skills to advertise <a target="_blank" rel="nofollow" href="https://www.facebook.com/realest8agent/">my business.</a>  This time I decided to send out postcards to an entire neighborhood in which I had sold homes recently.  Typically, agents will buy a mail route from the post office and hand over their postcards.  In the spirit of frugality and proving a point, I cracked my knuckles and went hunting for data.</p>
<p><strong>Get the shapefiles.  </strong><a target="_blank" rel="nofollow" href="http://data-wake.opendata.arcgis.com/">Wake County Open Data</a> (or your local open data hub) has a wealth of county-level data including subdivision boundaries and individual address points.  Download both shapefiles and  load them into your favorite <a target="_blank" rel="nofollow" href="http://www.qgis.org/en/site/about/index.html">GIS program</a>.  This step can probably be done in R, but I find using QGIS fairly intuitive and much faster at plotting large shapefiles.</p>
<p><img sizes="(max-width: 244px) 100vw, 244px" data-image-description="" data-orig-file="https://i1.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-07-05-am.png?resize=244%2C184&amp;ssl=1" data-orig-size="953,719" data-image-title="screen-shot-2017-02-15-at-11-07-05-am" class="wp-image-153" data-comments-opened="1" data-recalc-dims="1" data-attachment-id="153" data-permalink="https://realdataweb.wordpress.com/2017/02/15/creating-a-mailing-list-in-qgis-and-r/screen-shot-2017-02-15-at-11-07-05-am/" alt="Screen Shot 2017-02-15 at 11.07.05 AM.png" data-medium-file="https://i1.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-07-05-am.png?resize=244%2C184&amp;ssl=1?w=300" data-large-file="https://i1.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-07-05-am.png?resize=244%2C184&amp;ssl=1?w=656" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i1.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-07-05-am.png?resize=244%2C184&ssl=1">     <img sizes="(max-width: 250px) 100vw, 250px" data-image-description="" data-orig-file="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-10-33-am.png?resize=250%2C183&amp;ssl=1" data-orig-size="655,479" data-image-title="screen-shot-2017-02-15-at-11-10-33-am" data-comments-opened="1" class="wp-image-156" data-recalc-dims="1" data-attachment-id="156" data-permalink="https://realdataweb.wordpress.com/2017/02/15/creating-a-mailing-list-in-qgis-and-r/screen-shot-2017-02-15-at-11-10-33-am/" alt="Screen Shot 2017-02-15 at 11.10.33 AM.png" data-medium-file="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-10-33-am.png?resize=250%2C183&amp;ssl=1?w=300" data-large-file="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-10-33-am.png?resize=250%2C183&amp;ssl=1?w=655" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-10-33-am.png?resize=250%2C183&ssl=1"></p>
<p><strong>Filter the addresses.  </strong>After loading the address and subdivision shapefiles into QGIS, clip the address shapefile using the subdivision shapefile to save the addresses of interest in a new layer.  Save that puppy as a .csv and we can load it up in R.</p>
<p><img sizes="(max-width: 368px) 100vw, 368px" data-image-description="" data-orig-file="https://realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-24-11-am.png" data-orig-size="670,579" data-image-title="screen-shot-2017-02-15-at-11-24-11-am" data-comments-opened="1" class="wp-image-167" data-recalc-dims="1" data-attachment-id="167" data-permalink="https://realdataweb.wordpress.com/2017/02/15/creating-a-mailing-list-in-qgis-and-r/screen-shot-2017-02-15-at-11-24-11-am/" alt="Screen Shot 2017-02-15 at 11.24.11 AM.png" data-medium-file="https://realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-24-11-am.png?w=300" data-large-file="https://realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-24-11-am.png?w=656" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-24-11-am.png?resize=368%2C318&ssl=1"></p>
<p><strong>Manipulate in R.  </strong>Now we’ve got the info we want.  A few lines of code will give us something the post office (or Excel) will understand.</p>
<p><img sizes="(max-width: 656px) 100vw, 656px" data-image-description="" data-orig-file="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-35-42-am.png?w=456&amp;ssl=1" data-orig-size="834,349" data-image-title="screen-shot-2017-02-15-at-11-35-42-am" data-comments-opened="1" class="wp-image-184" data-recalc-dims="1" data-attachment-id="184" data-permalink="https://realdataweb.wordpress.com/2017/02/15/creating-a-mailing-list-in-qgis-and-r/screen-shot-2017-02-15-at-11-35-42-am/" alt="screen-shot-2017-02-15-at-11-35-42-am" data-medium-file="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-35-42-am.png?w=456&amp;ssl=1?w=300" data-large-file="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-35-42-am.png?w=456&amp;ssl=1?w=656" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i0.wp.com/realdataweb.files.wordpress.com/2017/02/screen-shot-2017-02-15-at-11-35-42-am.png?w=456&ssl=1"></p>
<pre>walden_creek &lt;- read_csv(&quot;~/Desktop/walden creek.csv&quot;)
attach(walden_creek)
adds &lt;- paste(FULLADDR, POSTAL_CIT, &quot;NC&quot;, &quot;27523&quot;, sep = &quot;,&quot;)
detach(walden_creek)
write.table(adds, &quot;adds.csv&quot;, sep = &quot;,&quot;)
</pre>
<p>Short and sweet, but I thought this was an interesting way to use data for a practical purpose.  People seem to be using R in exciting ways these days – if you see any creative, different projects please share.</p>
<p>– Kiefer Smith</p>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/realdataweb.wordpress.com/128/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/realdataweb.wordpress.com/128/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://realdataweb.wordpress.com/2017/02/15/creating-a-mailing-list-in-qgis-and-r/"> R – Real Data</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/eknDZnUhnsU"></a></div>