View source: R/f_data_processing.R
data_norm | R Documentation |
The function normalizes grammage units of products and recalculates product prices and quantities with respect to these normalized grammage units.
data_norm(
data = data.frame(),
rules = list(c("ml", "l", 1000), c("g", "kg", 1000)),
all = TRUE
)
data |
The user's data frame. The data frame must contain the following columns: |
rules |
User rules for transforming |
all |
A logical value indicating whether the resulting data frame is to be limited to products with detected grammage. Its default value is |
The function returns the user's data frame with two transformed columns: grammage
and unit
, and two rescaled columns: prices
and quantities
. The above-mentioned transformation and rescaling take into consideration the user rules
. Recalculated prices and quantities concern grammage units defined as the second parameter in the given rule.
# Preparing a data set
data<-data_unit(dataU, units=c("g|ml|kg|l"), multiplication="x")
# Normalization of grammage units
data_norm(data, rules=list(c("ml","l",1000), c("g","kg",1000)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.