data_unit {PriceIndices} | R Documentation |
Providing information about the grammage and unit of products
Description
The function returns the grammage and unit of products as two additional columns.
Usage
data_unit(data = data.frame(), units = c("g|ml|kg|l"), multiplication = "x")
Arguments
data |
The user's data frame. The data frame must contain the |
units |
Units of products which are to be detected (e.g. "ml|g|kg") |
multiplication |
A sign of the multiplication used in product descriptions (e.g. "x") |
Value
The function returns the user's data frame with two additional columns: grammage
and unit
. The values of these columns are extracted from product descriptions on the basis of provided units
. Please note, that the function takes into consideration a sign of the multiplication, e.g. if the product description contains: '2x50 g', we obtain: grammage: 100
and unit: g
for that product (for multiplication
set to 'x').
Examples
data_unit(dataU, units=c("g|ml|kg|l"), multiplication="x")
[Package PriceIndices version 0.1.9 Index]