title: Create a gridded dataset in sp and gstat - R
body: <p>I have trouble getting my data to create a grid using sp and gstat package in R. 
  I have a relatively small data set with GPS coordinates and I want to interpolate my data and make a gridded map. My data is in a csv file and is currently not in a shapefile or raster. </p>
  
  <p>I've so far been able to plot my data points with the "bubbles" function, and now I am trying to create a grid. 
  But I constantly get this error: </p>
  
  <blockquote>
    <p>gridded(test_2) = T
    suggested tolerance minimum: 0.75 
    Error in points2grid(points, tolerance, round) : 
      dimension 1 : coordinate intervals are not constant</p>
  </blockquote>
  
  <p>I am not sure why the intervals are not constant, or how it might be possible to "manipulate" them to be. I have measured distances from shore from 0-1000 m, that I normalized to 0-1.  </p>
  
  <p>Any suggestions on how to make the intervals constant?</p>
  
  <p>Thanks !!</p>
  
  <p>Karen</p>
  
  <p>Code example:</p>
  
  <pre><code>library(sp)
  library(gstat)
  test_2_2 &lt;- read.csv("test_2_2.csv")
  
  summary(test_2_2)
        Lat             Long          Sample.id       Water.level      Temp          Salinity         Chl_a       
   Min.   :33.14   Min.   :-117.4   Min.   :  1.00   Bottom :34   Min.   :19.00   Min.   :30.43   Min.   :  7.57  
   1st Qu.:33.14   1st Qu.:-117.3   1st Qu.: 69.25   Surface:36   1st Qu.:24.50   1st Qu.:33.40   1st Qu.: 22.63  
   Median :33.14   Median :-117.3   Median :102.50                Median :24.70   Median :33.45   Median : 29.07  
   Mean   :33.14   Mean   :-117.3   Mean   : 95.54                Mean   :24.46   Mean   :33.34   Mean   : 30.15  
   3rd Qu.:33.14   3rd Qu.:-117.3   3rd Qu.:129.75                3rd Qu.:25.10   3rd Qu.:33.47   3rd Qu.: 35.53  
   Max.   :33.15   Max.   :-117.3   Max.   :153.00                Max.   :25.95   Max.   :33.94   Max.   :116.07  
                                                                                  NA's   :1       NA's   :5       
      Nitrate      
   Min.   :0.1330  
   1st Qu.:0.4260  
   Median :0.5480  
   Mean   :0.8324  
   3rd Qu.:0.7970  
   Max.   :4.7700  
   NA's   :11      
  
  
  coordinates(test_2_2) = ~Lat+Long
  bubble(test_2_2, "Temp")
  
  test_2 &lt;- read.csv("test_2.csv") # Import grid data
  names(test_2)
  [1] "Dist" "Lat"  "Long"
  coordinates(test_2) = ~Lat+Long
  class(test_2)
  [1] "SpatialPointsDataFrame"
  attr(,"package")
  [1] "sp"
  names(test_2)
  [1] "Dist"
  gridded(test_2) = T
  suggested tolerance minimum: 0.75 
  Error in points2grid(points, tolerance, round) : 
    dimension 1 : coordinate intervals are not constant
  </code></pre>