minRateJumps: Minimize jumps in experimental input rates

View source: R/rxFuns.R

minRateJumpsR Documentation

Minimize jumps in experimental input rates

Description

This function is used to minimize the number of levels that adjacent treatment blocks can vary. This is to reduce rate jumps that are hard on equipment. The arguments are the prescription/experiment data frame with grid cell id's and rates applied, the direction to minimize jumps across the field ('N/S' or 'E/W') which corresponds to the general bearing of the application, and the total number of unique rates applied. This is typically the number of experimental and/or optimized rates and the base rate.

This function goes through each cell and makes sure that the rate of the surrounding row/col (depending on 'min_rate_jump' selection) are within two rate levels. If the surrounding treatment rate is not within 2 rate levels, it is randomly swapped with another treatment cell that is within 2 rate levels of the original, so long as the original is within 2 rate levels of the potentially swapped treatment neighbors. This is so that the original treatment rate does not undo previous rate minimization. This will not guarantee eradication of all rate jumps, but will reduce the amount.

Usage

minRateJumps(rx_sdt, min_rate_jumps, rate_lengths)

Arguments

rx_sdt

A 'sf' object containing the experiment or prescription generated by user inputs.

min_rate_jumps

Either 'N/S' or 'E/W' to indicate direction in which to minimize rate jumps. This is the predominant direction that the experimental input is applied across the field.

rate_lengths

The total number of rates applied in the experiment/prescription. This is any combination, when relevant, of the length of experimental and/or optimized rates, and the base rate.

Value

A 'sf' object containing the experiment or prescription data with minimized jumps between rates.


paulhegedus/OFPE documentation built on Nov. 23, 2022, 5:09 a.m.