Learn R Programming

hsdar (version 0.5.1)

distMat3D: Methods to create, manipulate and query objects of class 'DistMat3D'.

Description

Methods to create, manipulate and query objects of class 'DistMat3D'. The following relational operators are defined to compare values between 'DistMat3D'-object(s): <, <="," ==",">, >=

Usage

## Creation of objects "distMat3D"(x, ncol, nlyr) "distMat3D"(x, lower_tri = TRUE)
"distMat3D"(x, lower_tri = TRUE)
## Conversion methods "as.array"(x)
"as.matrix"(x, lyr = 1)
## Query of properties "dim"(x)
"ncol"(x)
"nrow"(x)
## Manipulate and query data in objects "["(x, i, j, n)
"["(x, i, j, n) <- value
"show"(object)

Arguments

x,object
Matrix, numeric or array in cases of creation of 'DistMat3D' objects otherwise object of class 'DistMat3D'.
ncol
Number of columns in the new 'DistMat3D' object.
nlyr
Number of layer in the new 'DistMat3D' object.
lower_tri
Flag if only the lower triangle is used.
lyr
Layer in the 'DistMat3D' object to be transformed into matrix.
value
Object of class numeric, matrix or array which is used for replacement of the values in x.
i,j,n
Subscripts to access data.

See Also

DistMat3D, apply, Nri

Examples

Run this code
data(spectral_data)

## Mask channel crossing part (arround 1050 nm) and strong 
## water absorption part (above 1350 nm)
mask(spectral_data) <- c(1045, 1055, 1350, 1706)

## Calculate SAM distances (object of class 'dist')
sam_dist <- dist.speclib(subset(spectral_data, season == "summer"))

## Convert to class 'distMat3D'
sam_dist <- distMat3D(as.matrix(sam_dist))

sam_dist

Run the code above in your browser using DataLab