Learn R Programming

geo (version 1.4-3)

combine.rt: Aggregate data on square grid, pad with zeros. Faster than tapply.

Description

Function that smooths data so data. In each given square where the number of points exceeds certain minimum the program gives the mean, sum, variance or median of the points within the square as well as the number of points and indication if the minimum number of points was reached. For each datapoint latitude, longitude and z has to be given. The program returns the mean and mean longitude for points within a square, as well as the number of points behind that point. The program also has the possibility to remove outliers within each square. This program can be used to prepare data for the program pointkriging if the data is so dense in certain places that it disturbs the neighbourhood search or if there are +10000 datapoints.

Usage

combine.rt(lat, lon, z, grlat, grlon = 0, fun, fill = F, reg = 0, minnumber = 2, wsp = 0, wz = 0, wlat = 0, xy = F, rat = 0.2, type)

Arguments

lat
Latitude of datapoints. ( or x coordinates)
lon
Longitude of datapoints. (or y coordinate)
z
Values at datapoints.
grlat
Latitude of defined grid.
grlon
Longitude of defined grid. If 0 grlat is a list with components \$lat and \$lon.
fun
Function (?).
fill
If fill is T the center points of squares where the number of points does not reach the minimum is set to zero. Good for data like trawlers report where it can be assumed that there is little fish where they do not try.
reg
List with two components \$lat and \$lon. Points outside region are not returned. The list is typically output from the program define.area.
minnumber
Minimum number of points needed for the square to be valid. Default value is 2.
wsp
Workspace. Not of interest.
wz
Weighing for the z values. If one is trying to find the mean tons/hour in an area is it reasonable to weigh tons/hour by the catch. If the weight is zero within a square unweighed mean is used.
wlat
Weighing to find the mean latitude and mean longitude. It is often reasonable to weigh the latitude and the longitude by the catch.
xy
Projected? Default unprojected (lat/lon) values, FALSE.
rat
Ratio for "rm.outliers". If rat is for example 0.2 20% of the points on each side are moved. i.e. the middle 60% are kept. Default value is 0.6.
type
Only value with description rm.outliers.

Value

List with components \$lat,\$lon,\$z,\$n and \$fill. \$lat mean latitude of points within each square. \$lon mean longitude of points within each square \$z sum, mean, variance or median of data \$n Number of points behind point. If type = "rm.outliers" \$n this component stores the number of the square corresponding to each point. \$fill If 0 there are datapoints behind the points else it is an artificial point. (fill = T)

Details

It can also be used to find sums or averages of points within squares.

The program works quite fast even for very large datasets.

See Also

variogram, variofit, pointkriging, grid, geocontour.fill.