Learn R Programming

pacu (version 0.1.74)

pa_trial: EXPERIMENTAL FUNCTION - Create an interpolated trial object from as-applied data

Description

EXPERIMENTAL FUNCTION - Create an interpolated trial object from as-applied data

Usage

pa_trial(
  input,
  data.columns = NULL,
  data.units = NULL,
  grid = NULL,
  algorithm = c("none", "simple", "ritas"),
  var.label = "as.applied",
  boundary = NULL,
  smooth.method = c("none", "krige", "idw"),
  formula = NULL,
  out.units = NULL,
  conversion.factor = 1,
  na.to.zero = ifelse(algorithm == "ritas", TRUE, FALSE),
  cores = 1L,
  steps = FALSE,
  verbose = TRUE,
  ...
)

Value

an object of class trial

Arguments

input

an sf object containing the as applied trial

data.columns

When algorithm is ‘simple’, this argument should be a vector of length one indicating which column contains the ‘trial or as-applied’ data. When algorithm is ‘ritas’, an optional named vector with the column names for the variables ‘trial, angle, swath, distance’. If a an unnamed vector is supplied, the vector is assumed to be in this order. The default is NULL, in which case the function attempts to guess the columns by using a dictionary of possible guesses. The column indicating the ‘trial’ information is not guessed, as there are too many possible options (seeds, fertilizer, soil amendments, etc).

data.units

When algorithm is ‘simple’, should be a vector of length one indicating the units of the trial column and the moisture column. Common values would be ‘c('kg N/ha', 'seeds/acre')’. When algorithm is ‘ritas’, an optional named vector with strings representing units for the variables ‘trial, angle, swath, distance’. If a an unnamed vector is supplied, the vector is assumed to be in this order. A typical value for this argument would be ‘c(trial = 'kg N/ha', angle = 'degreeN', width = 'ft', distance = 'ft')’. Please see valid_udunits for help with specifying units. The default is NULL, in which case the function attempts to guess the units according to the values of the variable. The units of ‘trial’ are not guessed, as there are too many possible options (seeds, fertilizer, soil amendments, etc).

grid

an sf object containing the prediction grid. If the user is processing as-applied data coming from a research trial (i.e. follows a trial design), the user can pass the sf object containing the trial design information to this argument.

algorithm

algorithm used to generate the yield object.

var.label

optional string to name the final product. Defaults to ‘as.applied’.

boundary

optional sf object representing the field's outer boundary. If it not supplied, the function attempts to generate a boundary from the observed points.

smooth.method

the smoothing method to be used. If ‘none’, no smoothing will be conducted. If ‘idw’, inverse distance weighted interpolation will be conducted. If ‘krige’, kriging will be conducted.

formula

formula defining the relationship between the dependent and independent variables. If the dependent variable is a linear function of the coordinates, the formula can be ‘z ~ X + Y’. If the dependent variable is modeled only as a function of the mean spatial process, the formula can be ‘z ~ 1’. If no formula is supplied, it defaults to ‘z ~ 1’.

out.units

units of the output after being multiplied by the conversion factor. If conversion.factor is 1 and out.units is NULL, out.units will default to the units of the trial input.

conversion.factor

a conversion factor by which the input trial data will be multiplied. This is useful for cases in which the user wants the output in different units from the input. A trivial example is a fertilizer trial in which the fertilizer contained in the input is only 50 In this case, conversion.factor should be set to 0.5.

na.to.zero

whether areas in which the trial applicator has not covered should be assigned a value of zero. This is only effective when ‘algorithm’ is ‘ritas’. Defaults to TRUE when ‘algorithm’ is ‘ritas’.

cores

the number of cores used in the operation

steps

whether to return the intermediate steps of the trial processing algorithm

verbose

whether to print function progress. ‘FALSE or 0’ will suppress details. ‘TRUE or 1’ will print a progress bar. ‘>1’ will print step by step messages.

...

additional arguments to be passed krige and idw

Author

Caio dos Santos and Fernando Miguez

Details

This function will follow the steps in the selected algorithm to produce a map of as-applied trial from the raw data.

Examples

Run this code
if (FALSE) {
## tbd
}

Run the code above in your browser using DataLab