Learn R Programming

easynem (version 1.0.3)

trans_formula: Formula conversion for easynem's meta

Description

The trans_formula() is used to convert the formula of easynem meta. Formula transformation is sometimes necessary in nematode community analysis. For example, to ensure that the data is normally distributed, it is often necessary to perform ln(x+1) transformation or other forms of formula transformation on nematode abundance. This function only works on a single variable. For a vectorized variant of this function, see trans_formula_v.

Usage

trans_formula(data, var, formu)

Value

An easynem-class data that stores the result of formula conversion.

Arguments

data

An easynem-class data.

var

Variable name to be converted.

formu

Formula parameters for data conversion. Such as ~log(x+1).

Details

To facilitate code interpretation, it is recommended to use the pipe symbol |> to connect functions:

nem_trans <- nem |> trans_formula(Mesorhabditis, ~log(x+1))

See Also

Other functions in this package for filtering and transforming data sets: filter_name, filter_num, trans_formula_v, trans_name, trans_norm, trans_rare, trans_combine

Examples

Run this code
nem <- read_nem2(tab = nemtab, tax = nemtax, meta = nemmeta)
nem_trans <- nem |> trans_formula(Mesorhabditis, ~log(x+1))
show(nem_trans)

Run the code above in your browser using DataLab