weightFun: weight function

View source: R/weightFun.R

weightFunR Documentation

weight function

Description

Generic weight function for use with estWD.

Usage

weightFun(
  x,
  propTable,
  type,
  typeCol,
  distanceCol,
  propCol,
  xFun = ceiling,
  maxDistance = NULL,
  ...
)

Arguments

x

Numeric vector.

propTable

Data frame contain the proportion of area searched by distance and plot type.

type

Character, indicating which plot type to subset propTable.

typeCol

Character, column name of the plot type in propTable.

distanceCol

Character, column name of the distance in propTable.

propCol

Character, column name of the proportion of area searched in propTable.

xFun

Function, default is ceiling, see details.

maxDistance

Numeric, default is NULL. If a value is given then propTable is subsetted to where propTable[,distanceCol] <= maxDistance.

...

Additional arguments passed to xFun.

Details

The weightedDistribution function requires the weights be described using a function. This allows integration to happen.

Typically propTable has integer values for the distances, but the function needs to take in any numeric values, the xFun function is how any numeric value can be matched up to the values in propTable. If the distances in propTable correspond to the outer radius of the annuli, for calculating proportion of area searched, then the ceiling is appropriate. If the distances in propTable correspond to the inner radius of the annuli then the floor might be more appropriate.

Value

Numeric vector of weights with length equal to length(x), and with a 1:1 relationship to the values in x.

See Also

estWD

Examples


data(proportionAreaSearched)

d <- c(-300.23,14.3,16,75)

## RP proportion of area searched
weightFun(x=d,propTable=proportionAreaSearched,type='RP',typeCol='plotType',
distanceCol='distanceFromTurbine',propCol='proportionAreaSearched')
#[1] 0.00000000 0.08896480 0.08308577 0.01709869

## FULL plot proportion of area searched
weightFun(x=d,propTable=proportionAreaSearched,type='FULL',typeCol='plotType',
distanceCol='distanceFromTurbine',propCol='proportionAreaSearched')
# [1] 0 1 1 1

### with a max distance restriction
## RP proportion of area searched
weightFun(x=d,propTable=proportionAreaSearched,type='RP',typeCol='plotType',
distanceCol='distanceFromTurbine',propCol='proportionAreaSearched',maxDistance=40)
# [1] 0.00000000 0.08896480 0.08308577 0.00000000

## FULL plot proportion of area searched
weightFun(x=d,propTable=proportionAreaSearched,type='FULL',typeCol='plotType',
distanceCol='distanceFromTurbine',propCol='proportionAreaSearched',maxDistance=40)
# [1] 0 1 1 0



windAC documentation built on March 31, 2023, 9:30 p.m.

Related to weightFun in windAC...