env_typing: Environmental Typologies based on Cardinal or Quantilic...

View source: R/EnvTyping.R

env_typingR Documentation

Environmental Typologies based on Cardinal or Quantilic Limits

Description

Returns environmental typologies that can be used as envirotype markers. This typologies are given based on cardinals (discrete intervals for each variable). The user must inform the name of the environmental variables of interest and inform the cardinal option as list of cardinal vectors for each variable. Its also possible to fix intervals or scale data.

Usage

env_typing(
  env.data,
  var.id,
  env.id,
  cardinals = NULL,
  days.id = NULL,
  time.window = NULL,
  names.window = NULL,
  quantiles = NULL,
  id.names = NULL,
  by.interval = FALSE,
  scale = FALSE,
  format = NULL
)

Arguments

env.data

data.frame of environmental variables gotten from get_weather().

var.id

character. Indicates which variables will be used in the analysis.

env.id

vector (character). Indicates the name of the columns to be used as id for environments.

cardinals

list (numeric). A list of cardinals (vector of numeric thresholds) for each variable. Indicates the cardinal limtis for each environmental type. If is NULL, see quantles argument.

days.id

character. Name of the columns indicating the days from start.

time.window

vector (numeric). If by.interval = TRUE, this argument indicates the temporal breaks for delimited intervals.

names.window

vector(character). If by.interval = TRUE, this argument indicates the names of the desirable intervals.

quantiles

vector (numeric). Indicates the probability quantiles, as probs = 0,1, if cardinals is NULL. If is quantiles=NULL, quantiles = c(0.01,.25,.50,.99).

id.names

vector (character). Indicates the name of the columns to be used as id for the environmental variables to be analysed.

by.interval

boolean. Indicates if temporal intervals must be computed insied of each environment. Default = FALSE.

scale

boolean. If scale=TRUE, the variables (x) assumes a mean-centered scaled distribution, with x~N(0,1).

format

character. The shape of the output, assuming format = c('long','wide'). Default is 'long'.

Details

TODO

Value

A dataframe with environmental typologies. Event frequencies are provided for each variable at each environment within each interval.

Author(s)

Germano Costa Neto

Examples

## Not run: 
### Fetching weather information from NASA-POWER
env.data = get_weather(lat = -13.05, lon = -56.05)

### By.intervals (generic time intervals)
env_typing(env.data = env.data, env.id = 'env', var.id = 'T2M', by.interval = TRUE)

### By.intervals (specific time intervals)
env_typing(env.data = env.data,
          env.id = 'env',
          var.id = 'T2M',
          by.interval = TRUE,
          time.window = c(0, 15, 35, 65, 90, 120))

### By.intervals (specific time intervals and with specific names
env_typing(env.data = env.data,
                 env.id = 'env',
                 var.id = 'T2M',
                 by.interval = TRUE,
                 time.window = c(0, 15, 35, 65, 90, 120),
                 names.window = c('1-intial growing',
                                  '2-leaf expansion I',
                                  '3-leaf expansion II',
                                  '4-flowering',
                                  '5-grain filling',
                                  '6-maturation'))

### With set cardinals.
env_typing(env.data = env.data,
          var.id = c('T2M','PRECTOT','WS2M'),
          cardinals = list(T2M = c(0, 9, 22, 32, 45),
                           PRECTOT = c(0, 5, 10),
                           WS2M = NULL),
          env.id = 'env')

## End(Not run)

allogamous/EnvRtype documentation built on Nov. 1, 2024, 3:48 a.m.