highAndLow {rexposome} | R Documentation

## Function to convert continuous exposures to categorical exposures

### Description

This method allows to convert continuous exposures of an `ExposomeSet` to categorical exposures using the n-percentile groups, defined by `ngroups` argument. By default, all levels are kept but if `intervals` is set to `"extrem"`, the levels between the extrems (aka. lowes and highest) are discarted and their values set to `NA`.

### Usage

    highAndLow(
      object,
      ngroups = 3,
      intervals = "standard",
      select,
      drop = FALSE,
      warnings = TRUE
    )

### Arguments

`object` | An object of class `ExposomeSet`.
`ngroups` | (default `3`) Number of intervals to be created.
`intervals` | (default `"standard"`) If set to `"sctandard"` all levels are set. If set to `"extreme"` obly lowes and highest levels are kept (others are set to `NA`).
`select` | (optional) Subset of exposures where the discretization is applied. If missing, all exposures are used.
`drop` | (default `FALSE`) If set to `FALSE` original exposures are kept and discretized exposures are add to `ExposomeSet`. If set to `TRUE`, original exposures are replaced by categorical exposures.
`warnings` | (defaulr `TRUE`) If set to `FALSE` warnings are not shown.

### Value

A new `ExposomeSet` with categorical exposures.

### See Also

`trans` to transform exposures, `standardize` to standardize exposures.

### Examples

    # No drop
    data("exposome")
    exp.hl <- highAndLow(expo, intervals = "standard", select = "ldde_lip")
    dim(exp.hl)
    # exposures   samples phenotyes
    #       105      1200         4
    dim(expo)
    # exposures   samples phenotyes
    #       104      1200         4
    # exps.hl has 107 exposures: the original 104 plus the new
    #         3 factored exposures

    # Drop
    exp.hl <- highAndLow(expo, intervals = "standard",
        select = "ldde_lip", drop = TRUE)
    dim(exp.hl)
    # exposures   samples phenotyes
    #       104      1200         4
    dim(expo)
    # exposures   samples phenotyes
    #       104      1200         4

[Package rexposome version 1.16.0 Index]