order_maps: Sort a list of mappings

View source: R/map_utilities.R

order_mapsR Documentation

Sort a list of mappings

Description

Sort a list of mappings so that the sequential application of the mappings yields the correct result.

Usage

order_maps(maps)

Arguments

maps

List of mapping objects, e.g., as obtained by create_map.

Details

Mappings whose source indices contain target indices of another mapping must not be applied before that mapping. This function puts the mappings into an order to ensure this criterion is met.

Value

Return a list with the ordered maps

Examples

params1 <- list(
  mapname = "mylinearmap1",
  maptype = "linearinterpol_map",
  src_idx = 1:3,
  tar_idx = 4:6,
  src_x = c(1,5,10),
  tar_x = c(4,5,6)
)
params2 <- list(
  mapname = "mylinearmap2",
  maptype = "linearinterpol_map",
  src_idx = 4:6,
  tar_idx = 7:9,
  src_x = c(4,5,7),
  tar_x = c(4.5, 5, 5.5)
)
mymap1 <- create_map(params1)
mymap2 <- create_map(params2)
ordmaps <- order_maps(list(mymap2, mymap1))
lapply(ordmaps, function(x) x$getName())


gschnabel/nucdataBaynet documentation built on Feb. 3, 2023, 4:13 a.m.