title: Transform data frame to shape file
body: <p>Originally I had a TIGER shape file downloaded from the U.S. Census website. The shape file contains all roads in Harris county, Texas. It contained 7 features, 1) the identifying number (FID), 2) its shape (polyline), 3) the linear id, 4) The street name, 5) the route type code, 6) the MAF/TIGER feature class code, and 7) the distance of each road in feet. </p>
  
  <p>I imported it into R so I could assign speeds based on the feature class code and calculate the drive time on each road. I need to import this back into ArcGIS, in the form of a shape file. </p>
  
  <pre><code>writeOGR(revised.data, "harris_shape_file", layer = "harris_travel_revised", driver = "ESRI Shapefile")
  </code></pre>
  
  <p>However, this is throwing an error saying "inherits(ojb, "Spatial") is not TRUE". Now I don't work with shape files often and am a novice in GIS. I am looking for some quick feedback/suggestions as to what might be going on. Obviously R doesn't recognize the data frame as a 'spatial' one, but I'm not sure how to change that.</p>
  
  <p>I imported the data file and converted the attributes to a frame with </p>
  
  <pre><code>roads.data &lt;- readORG(dsn="harris_shape_file/")
  roads &lt;- roads.data@data
  </code></pre>
  
  <p>I made revised data as the following...</p>
  
  <pre><code># mtfcc.codes are based off of unique mtfcc values, excluding parking lot 
  # roads, government use, private roads, vehucular trails, bike paths and 
  # pedestrian walkways.
  mtfcc.codes &lt;- c("S1400", "S1200", "S1100", "S1630", "S1730")
  
  revised.data &lt;- data.frame(matrix(nr=0, nc=6))
  colnames(revised.data) &lt;- c("LINEARID", "FULLNAME", "RTTYP", "MTFCC", "DISTANCE")
  
  # assign speed limit based on mtfcc code
  for(i in as.character(mtfcc.codes)){
    m.sub &lt;- subset(roads, grepl(paste(i), roads[,4]))
    if(i == "S1400"){
      m.sub[,6] &lt;- "25"
    }
    if(i == "S1200"){
      m.sub[,6] &lt;- "45"
    }
    if(i == "S1100"){
      m.sub[,6] &lt;- "65"
    }
    if(i == "S1630"){
      m.sub[,6] &lt;- "25"
    }
    if(i == "S1730"){
      m.sub[,6] &lt;- "15"
    }
    revised.data &lt;- rbind(revised.data, m.sub)
    print(i)
  }
  colnames(revised.data)[6] &lt;- "SPEED"
  
  # calculate drive time on each route
  revised.data[,5] &lt;- as.numeric(as.character(revised.data[,5]))
  revised.data[,6] &lt;- as.numeric(revised.data[,6])
  
  for(i in 1:nrow(revised.data)){
    revised.data[i,7] = revised.data[i,5]*(60/revised.data[i,6])
    print(i)
  }
  
  colnames(revised.data)[7] &lt;- "TIME"
  </code></pre>