near.obs.soil: Nearest observatios for soil mapping.

View source: R/near.obs.soil.R

near.obs.soilR Documentation

Nearest observatios for soil mapping.

Description

The function finds n nearest observations from given locations and at specific depth range from location min depth and creates an object of data.frame class, where first n columns are Euclidean distances to n nearest locations and next n columns are observations at n nearest stations, and rows are given locations. It is based on knn function of package nabor.

Usage

near.obs.soil(locations,
              locations.x.y.md = c(1,2,3),
              observations,
              observations.x.y.md = c(1,2,3),
              zcol = 4,
              n.obs = 5,
              depth.range = 0.1,
              no.obs = 'increase')

Arguments

locations

data.frame with x and y coordinates and mid depth columns, or SpatialPoints-class, SpatialPointsDataFrame-class or SpatialPixelsDataFrame-class object. Locations from which distances to observations are calculated.

locations.x.y.md

numeric or character vector; Positions or names of the x, y, and mid depth columns in locations if data.frame. Default is c(1,2,3).

observations

data.frame with x, y, mid depth and observation columns, or SpatialPoints-class or SpatialPointsDataFrame-class object with mid depth and observation columns. Observations to which distances to locations are calculated.

observations.x.y.md

numeric or character vector; positions or names of the x, y, and mid depth columns in observations if data.frame. Default is c(1,2,3).

zcol

numeric or character; Column name or number showing the position of observations in observations. Default is 3.

n.obs

numeric; Number of nearest observations to be found. Note that it cannot be larger than number of observations. Default is 5.

depth.range

numeric; Depth range from location mid depth in which to search for nearest observations. It is in the mid depth units. Default is 0.1.

no.obs

character; Possible values are increase (default) and exactly. If set to increase, for locations where there is no n.obs observations in depth.range, the depth.range is increased (multiplied by 2, 3, ...) until there the number of observations are larger or equal to n.obs. If set to exactly, the function will raise an error for the first locations where there is no n.obs observations in depth.range.

Value

data.frame object. Rows represents given locations. First n.obs columns are Euclidean distances to n.obs nearest observations. Next n.obs columns are observations at n.obs nearest stations.

Note

The function is intended for soil mapping applications.

Author(s)

ALeksandar Sekulic asekulic@grf.bg.ac.rs, Anatol Helfenstein anatol.helfenstein@wur.nl

See Also

knn near.obs rfsi pred.rfsi tune.rfsi cv.rfsi


cmcl06/cmcl06 documentation built on April 5, 2022, 12:05 a.m.