stretch_nltt_matrix: Stretch matrix 'm' with a timestep resolution of 'dt'.

View source: R/stretch_nltt_matrix.R

stretch_nltt_matrixR Documentation

Stretch matrix 'm' with a timestep resolution of 'dt'.

Description

Stretch matrix 'm' with a timestep resolution of 'dt'.

Usage

stretch_nltt_matrix(m, dt, step_type)

Arguments

m

A matrix of 2 columns and at least 2 rows

dt

The resulution, a value e [0.0001, 1]. If 'dt' is set to a very small value, this function will stop

step_type

when between two points, where the second point has both a higher x and y coordinat, which y coordinat to follow. 'step_type' can be:

  • lower maintain the y-coordinat of the leftmost point

  • upper already use the y-coordinat of the rightmost point

Value

The stretched matrix

Author(s)

Richèl J.C. Bilderbeek

Examples

  m <- matrix( c(c(0.0, 1.0), c(0.5, 1.0)), ncol = 2, nrow = 2)
  expected <- matrix(
    c(
      c(0.0, 0.5, 1.0),  # Timepoints
      c(0.5, 0.5, 1.0)   # Values
    ),
    ncol = 2, nrow = 3
  )
  result <- stretch_nltt_matrix(m = m, dt = 0.5, step_type = "lower")
  all.equal(result, expected)


richelbilderbeek/nLTT documentation built on Aug. 23, 2023, 8 a.m.