Constructor for creating a single n-dimensional measurement object containing location coordinates (e.g., wavelength, retention time) and values.
Usage
new_measure_nd_tbl(..., value = double(), dim_names = NULL, dim_units = NULL)Arguments
- ...
Named location vectors. Names should follow the pattern
location_1,location_2, etc. Each must be a numeric vector of the same length.- value
Numeric vector of measurement values (e.g., absorbance, intensity, signal). Must have the same length as location vectors.
- dim_names
Optional character vector of semantic dimension names (e.g.,
c("wavelength", "retention_time")).- dim_units
Optional character vector of dimension units (e.g.,
c("nm", "min")).
Value
A tibble with class measure_nd_tbl containing location_1,
location_2, ..., location_n, and value columns. Attributes
include ndim, dim_names, dim_units, and dim_order.
See also
new_measure_nd_list() for creating collections of nD measurements,
is_measure_nd_tbl() for checking object class, measure_ndim() for
getting dimensionality.
Examples
# Create a 2D measurement (e.g., LC-UV: retention time x wavelength)
meas_2d <- new_measure_nd_tbl(
location_1 = rep(seq(0, 10, length.out = 5), each = 3),
location_2 = rep(c(254, 280, 320), times = 5),
value = rnorm(15),
dim_names = c("retention_time", "wavelength"),
dim_units = c("min", "nm")
)
meas_2d
#> <measure_nd_tbl [15 x 3] retention_time x wavelength>
#> <measure_tbl [15 x 3]>
#> # A tibble: 15 × 3
#> location_1 location_2 value
#> <dbl> <dbl> <dbl>
#> 1 0 254 -0.710
#> 2 0 280 0.257
#> 3 0 320 -0.247
#> 4 2.5 254 -0.348
#> 5 2.5 280 -0.952
#> 6 2.5 320 -0.0450
#> 7 5 254 -0.785
#> 8 5 280 -1.67
#> 9 5 320 -0.380
#> 10 7.5 254 0.919
#> 11 7.5 280 -0.575
#> 12 7.5 320 0.608
#> 13 10 254 -1.62
#> 14 10 280 -0.0556
#> 15 10 320 0.519