distMat3D | R Documentation |
Methods to create, manipulate and query objects of class 'DistMat3D'. The following relational operators are defined to compare values between 'DistMat3D'-object(s): <, <=, ==, >, >=
## 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)
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. |
Lukas Lehnert
DistMat3D
, apply
, Nri
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.