title: How to extract 'RS4' element in Rpy2
body: <p>I’m a Chinese reader of book “Applied Spatial Data Analysis with R”, which is very useful for spatial analysis work. I tried to translate the R code into python with the Rpy2, since python can handle more complex data sources.  But I have a problem with the Rpy2 code. The NY8 data is attached with the email. 
  The R code is:</p>
  
  <pre><code>library(rgdal)
  NY8&lt;-readOGR(".","NY8_utm18")
  Syracuse&lt;-NY8[NY8$AREANAME=="Syracuse city",]
  Sy2_nb&lt;-poly2nb(Syracuse,queen=FALSE)
  library(spdep)
  Sy2_nb&lt;-poly2nb(Syracuse,queen=FALSE)
  Sy2_lw&lt;-nb2listw(Sy2_nb)
  moran.plot(NY$POP8,Sy2_lw)
  </code></pre>
  
  <p>When I translate it with Rpy2, the code is:</p>
  
  <pre><code>&gt;&gt;&gt; from rpy2.robjects.packages import importr
  &gt;&gt;&gt; utils = importr('utils')
  &gt;&gt;&gt; utils.install_packages('rgdal')
  &gt;&gt;&gt; rgdal=importr('rgdal')
  &gt;&gt;&gt; import os
  &gt;&gt;&gt; os.chdir("C:\\PYDATA\\NY")
  &gt;&gt;&gt; NY8=rgdal.readOGR(".","NY8_utm18")
  &gt;&gt;&gt; print(robjects.r['summary'](NY8))
  </code></pre>
  
  <p>When I want to translate the code “Syracuse&lt;-NY8[NY8$AREANAME=="Syracuse city",]
  ”, for example:</p>
  
  <pre><code>&gt;&gt;&gt;Syracuse=NY8[NY8$AREANAME=="Syracuse city",]
  </code></pre>
  
  <p>The error message is shown: SyntaxError: invalid syntax
  It seems I could not extract the “AREANAME” through “$”, because “$” is illegal in python.</p>