Autokriging spatial data

I'm trying to use a kriging function to create vertical maps of chemical parameters in an ocean transect, and I'm having a hard time getting started.

My data look like this:

horiz=rep(1:5, 5)
depth=runif(25)
value = horiz+runif(25)/5
df <- data.frame(horiz, depth, value)

The autoKrige function in the automap package looks like it should do the job for me but it takes an object of class SpatialPointsDataFrame. As far as I can tell, the function spTransform in package rgdal creates SpatialPointsDataFrame objects, but there are two problems:

  • OSX binaries of this aren't available from CRAN, and my copy of RStudio running on OXS 10.7 doesn't seem to be able to install it, and

  • This function seems to work on lat/long data and correct distance values for the curvature of the Earth. Since I'm dealing with a vertical plane (and short distances, scale of hundreds of meters) I don't want to correct my distances.

There's an excellent discussion of kriging in R here, but due to the issues listed above I don't quite understand how to apply it to my specific problem.

I want a matrix or dataframe describing a grid of points with interpolated values for my chemical parameters, which I can then plot (ideally using ggplot2). I suspect that the solution to my problem is considerably easier than I'm making it out to be.

Answers


So there a a few question you want answered:

  1. The spTransform function does not create SPDF's, but transforms between projections. To create a SPDF you can use a simple data.frame as a start. To transform df to a SPDF:

    coordinates(df) = c("horiz", "depth")
    
  2. OS X binaries of rgdal can be found at http://www.kyngchaos.com. But I doubt if you need rgdal.

  3. spTransform can operate on latlong data, but also on projected data. But I do not think you need rgdal, or spTransform, see also point 1.

  4. After you create the SPDF using point 1, you can use the info at the post you mentioned to go on.


Need Your Help

Member registration not working

php mysql

I have made a small website, non-members can register with the website, when they register their details should be stired in the database table. I had this working but now it is not, it does everyt...

passing query array to codeigniter view

arrays codeigniter

iam facing problem in passing array to view.