These functions return the number of rows (spectra), columns, and/or data points per spectrum of a hyperSpec object. See section "Details".

# S4 method for hyperSpec
ncol(x)

# S4 method for hyperSpec
nrow(x)

nwl(x)

# S4 method for hyperSpec
dim(x)

# S4 method for hyperSpec
length(x)

Arguments

x

a hyperSpec object

Value

nrow(), ncol(), nwl(), and length() return an integer.

dim() returns a vector of length 3.

Details

  • ncol() returns the number of columns in x@data. I.e. the number of columns with additional information to each spectrum (e.g. "x", "y", ...) + 1 (for column spc containing the spectra).

  • nrow() yields the number of rows in x@data, i.e. the number of spectra in the hyperSpec object.

  • nwl() returns the number of columns in x@data$spc, i.e. thelength of each spectrum.

  • dim() returns all three values in a vector.

  • length() is a synonym for nrow(). It is supplied so that seq_along(x) returns a sequence to index each spectrum.

Author

C. Beleites

Examples

ncol(faux_cell)
#> [1] 4

nrow(faux_cell)
#> [1] 875

nwl(faux_cell)
#> [1] 300

dim(faux_cell)
#> nrow ncol  nwl 
#>  875    4  300 

length(faux_cell)
#> [1] 875