calc_treated_data: Calculate treated data using raw data and MRL

Description Usage Arguments Value Examples

View source: R/calc_treated_data.R

Description

'calc_treated_data()' construct a new data frame which construction is like raw_data that has multiple columns as labels and the renaming columns are detection values of each drug on each sample.

Usage

1
2
3
4
5
6
7
8
calc_treated_data(
  raw_data,
  mrl_data,
  st_drug,
  ed_drug,
  raw_col_en2cn = RawColnameTrans,
  product_name = ProductLabelName
)

Arguments

raw_data

a data frame. It is raw detection data of each sample on each drug. It has multiple columns as labels of each sample and the remaining columns are raw detection values.

mrl_data

a data frame. It has one column named "\u4ea7\u54c1\u540d\u79f0" and the other columns named with name of drugs. Every row is MRL value of one product on each drugs.

st_drug

a character. Name of the first column of drug.

ed_drug

a character. Name of the last column of drug.

raw_col_en2cn

list, default RawColnameTrans. It is the English to Chinese names of dimensions except product.

product_name

character. It is the product dimension name.

Value

a data frame with 3 extra columns compared with 'raw_data'.

Examples

1
2
3
4
5
6
# library(antgreens)
# set_dimensions("name", list(t1="t1", t2="t2"))
# df <- data.frame(name = c('a', 'b', 'a', 'c', 'c'),t1 = c(1,2,3,4,5),t2 = c(0,9,8,7,6))
# mrl <- data.frame(name = c('a','b','c'),t1 = c(2,2,4),t2 = c(4,10,6))
# mrl_map <- mapping_mrl(as.matrix(mrl[,2:3]), mrl$product)
# nvm <- calc_treated_data(as.matrix(df[,2:3]), mrl_map, "t1", "t2")

YuanchenZhu2020/antgreens documentation built on Dec. 18, 2021, 8:20 p.m.