<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Impossible to use dplyr join functions on data frames? in R-ArcGIS Questions</title>
    <link>https://community.esri.com/t5/r-arcgis-questions/impossible-to-use-dplyr-join-functions-on-data/m-p/812437#M175</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for a detailed example of what you're trying to do, very helpful. From what I understand, dplyr expects data frames that are very close to the base R representation. This affects other rich representations, like sp objects. I don't know of an immediate solution to bridge this discrepancy, but fortunately there's another way. Michael Sumner has created the &lt;A href="https://cran.r-project.org/web/packages/spdplyr/index.html" rel="nofollow noopener noreferrer" target="_blank"&gt;spdplyr package&lt;/A&gt;, which lets you use some of the functionality of dplyr on sp objects. Here's your script instead using the sp representations:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;library&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;spdplyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
library&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcgisbinding&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_product&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

fc &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;system&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;file&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"extdata"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ca_ozone_pts.shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; package&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"arcgisbinding"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
d &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;select&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fields&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;c&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'FID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'ozone'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;data2sp&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;d&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

p &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;select&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fields&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;c&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'FID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'ozone'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;data2sp&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;p&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp$ozone &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; p$ozone&lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;

joined &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; left_join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; by&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; copy&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;TRUE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
joined&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;df &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp2data&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;joined&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;write&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tempfile&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ca_ozone_pts_joined"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fileext&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;".shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; joined&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;df&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know if that'll work for your needs, or you need something different for what you're trying to do. You can do everything with just plain data frames, then later join on FID to bring that back into a single data source, but this is a nicer approach if it'll work for you.&lt;BR /&gt;&lt;BR /&gt;Cheers, Shaun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:33:45 GMT</pubDate>
    <dc:creator>ShaunWalbridge</dc:creator>
    <dc:date>2021-12-12T09:33:45Z</dc:date>
    <item>
      <title>Impossible to use dplyr join functions on data frames?</title>
      <link>https://community.esri.com/t5/r-arcgis-questions/impossible-to-use-dplyr-join-functions-on-data/m-p/812436#M174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt;I've just begun to use the R-ArcGIS bridge package &lt;/SPAN&gt;&lt;CODE&gt;arcgisbinding&lt;/CODE&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt; and am running into a problem when I try to join feature class data with the &lt;/SPAN&gt;&lt;CODE&gt;dplyr&lt;/CODE&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt; package. When I join them, the shape attributes in the data frame are dropped and I can only export it as a table, not as a feature class or shapefile.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt;Here is some toy reproducible code. Below, I'm trying to get the ozone measurement columns from two shapefiles into a single data frame, then export the data frame as a shapefile.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;library(dplyr)
library(arcgisbinding)
arc.check_product()

fc &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&amp;lt;-&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; arc.open&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;system.file&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;"extdata"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;"ca_ozone_pts.shp"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;, &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;package&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;"arcgisbinding"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;))
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;d &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&amp;lt;-&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; arc.select&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;fc&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; fields&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;c&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;'FID'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;'ozone'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;))
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;p&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&amp;lt;-&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;arc.select&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;fc&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;fields&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;c&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;'FID'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;'ozone'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;))
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;p&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;ozone&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&amp;lt;-&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;p&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;$&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;ozone&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;*&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;2
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;p&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&amp;lt;-&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;left_join&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;p&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;d&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;"FID"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;)
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;arc.write&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;tempfile&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;"ca_new"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; fileext&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;".shp"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;),&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; p&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;)
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: inherit;"&gt;# original dataframe has shape attributes
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;str&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;d&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;)
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: inherit;"&gt;# new dataframe does not
&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;str&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;p&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt;From the &lt;/SPAN&gt;&lt;CODE&gt;arcgisbinding&lt;/CODE&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt; package, &lt;/SPAN&gt;&lt;CODE&gt;p&lt;/CODE&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt; and &lt;/SPAN&gt;&lt;CODE&gt;d&lt;/CODE&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt; above are data frame objects with shape attributes. The problem is that once I use &lt;/SPAN&gt;&lt;CODE&gt;left_join&lt;/CODE&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt;, I lose the spatial attribute data in the joined data frame. Is there a way around this?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:33:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/r-arcgis-questions/impossible-to-use-dplyr-join-functions-on-data/m-p/812436#M174</guid>
      <dc:creator>IanDavies</dc:creator>
      <dc:date>2021-12-12T09:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Impossible to use dplyr join functions on data frames?</title>
      <link>https://community.esri.com/t5/r-arcgis-questions/impossible-to-use-dplyr-join-functions-on-data/m-p/812437#M175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for a detailed example of what you're trying to do, very helpful. From what I understand, dplyr expects data frames that are very close to the base R representation. This affects other rich representations, like sp objects. I don't know of an immediate solution to bridge this discrepancy, but fortunately there's another way. Michael Sumner has created the &lt;A href="https://cran.r-project.org/web/packages/spdplyr/index.html" rel="nofollow noopener noreferrer" target="_blank"&gt;spdplyr package&lt;/A&gt;, which lets you use some of the functionality of dplyr on sp objects. Here's your script instead using the sp representations:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;library&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;spdplyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
library&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcgisbinding&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;check_product&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

fc &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;open&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;system&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;file&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"extdata"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ca_ozone_pts.shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; package&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"arcgisbinding"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
d &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;select&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fields&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;c&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'FID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'ozone'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;data2sp&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;d&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

p &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;select&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;fields&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;c&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'FID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'ozone'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;data2sp&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;p&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp$ozone &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; p$ozone&lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;

joined &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; left_join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;p&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; d&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; by&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; copy&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;TRUE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
joined&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;df &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sp2data&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;joined&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

arc&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;write&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tempfile&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ca_ozone_pts_joined"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fileext&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;".shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; joined&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;df&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know if that'll work for your needs, or you need something different for what you're trying to do. You can do everything with just plain data frames, then later join on FID to bring that back into a single data source, but this is a nicer approach if it'll work for you.&lt;BR /&gt;&lt;BR /&gt;Cheers, Shaun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:33:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/r-arcgis-questions/impossible-to-use-dplyr-join-functions-on-data/m-p/812437#M175</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2021-12-12T09:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Impossible to use dplyr join functions on data frames?</title>
      <link>https://community.esri.com/t5/r-arcgis-questions/impossible-to-use-dplyr-join-functions-on-data/m-p/812438#M176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent! And not very hacky. Thanks Shaun.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Jun 2017 22:12:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/r-arcgis-questions/impossible-to-use-dplyr-join-functions-on-data/m-p/812438#M176</guid>
      <dc:creator>IanDavies</dc:creator>
      <dc:date>2017-06-13T22:12:28Z</dc:date>
    </item>
  </channel>
</rss>

