db.grid.copy {RGeoS}R Documentation

Copy variables from the Grid Db1 into the Grid Db2

Description

Copy variables from the Grid Db1 into the Grid Db2

Usage

db.grid.copy(db1, db2, names =NA, ngrep=NA, ind1 = NA, ind2 = NA, 
		  radix = NA, modify.target = TRUE)

Arguments

db1

The db-class used to read input variables

db2

The db-class used to store output variables

names

Vector of ranks of the attributes to be copied

ngrep

Generic name for the attributes. If defined, it overwrites the 'names' argument

ind1

This vector is dimensionned to the dimension of the input Grid Db. It provides the index values (considered as constant) for the dimensions which are not copied

ind2

This vector is dimensionned to the dimension of the output Grid Db. The value ind2[1] indicates the rank of the dimension in the input Grid Db.

radix

Radix of the name given to the variables storing the results in the output Grid Db.

modify.target

When TRUE, the results are set as new target variables in the output Db.

Details

Imagine that we performed db.grid.copy() from the 4-D Db1 into the 2-D Db2, using ind1=c(3,6,8,1) and ind2=c(2,-4). Let us denote by NDbi(j) the number of grid nodes along the j-th dimension for the i-th Db. In the following formula, we assume that the sample index varies from 1 to NDb. For each variable to be copied, the sample of Db2 numbered [i,j] will correspond to the sample of Db1 numbered [3,i,8,NDb2(4)-j-1]. In the previous formula, if the grid index along one direction (say the i-th) is negative, it is set to 1. If it exceeds NDb1(i), it is set to Ndb1(i).

Imagine that 'db' refers to a 2-D Db Grid File and that we want to duplicate the variable (rank=12) by inverting the row index. We simply have to type: db <- db.grid.copy(db,db,names=12,ind2=c(1,-2))

Value

The output Grid Db where the copied variables have been added.


[Package RGeoS version 9.1.1 Index]