DistMat3D-methods: Methods to create, manipulate and query objects of class...

Description Usage Arguments Author(s) See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Creation of objects
## S4 method for signature 'numeric'
distMat3D(x, ncol, nlyr)  
  
## S4 method for signature 'matrix'
distMat3D(x, lower_tri = TRUE)

## S4 method for signature 'array'
distMat3D(x, lower_tri = TRUE)

## Conversion methods
## S4 method for signature 'DistMat3D'
as.array(x)

## S4 method for signature 'DistMat3D'
as.matrix(x, lyr = 1)

## Query of properties
## S4 method for signature 'DistMat3D'
dim(x)

## S4 method for signature 'DistMat3D'
ncol(x)

## S4 method for signature 'DistMat3D'
nrow(x)

## Manipulate and query data in objects
## S4 method for signature 'DistMat3D'
x[i, j, n]

## S4 replacement method for signature 'DistMat3D'
x[i, j, n] <- value


## S4 method for signature 'DistMat3D'
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.

Author(s)

Lukas Lehnert

See Also

DistMat3D, apply, Nri

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
data(spectral_data)

## Mask channel crossing part (around 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))

## Default print of DistMat3D-object
sam_dist

## Convert back to matrix
as.matrix(sam_dist)

## Get number of rows and samples
dim(sam_dist)

## Compare values in DistMat3D-object
small_dists <- sam_dist < 0.02

## Convert small_dists-object to DistMat3D
distMat3D(as.numeric(small_dists), 15, 1)

hsdar documentation built on Dec. 14, 2017, 5:16 p.m.