weightFun {windAC} | R 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 |
typeCol |
Character, column name of the plot type in |
distanceCol |
Character, column name of the distance in |
propCol |
Character, column name of the proportion of area searched in |
xFun |
Function, default is |
maxDistance |
Numeric, default is |
... |
Additional arguments passed to |
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
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