Table of distinct factors (sample annotation)

table_factors(pdata, configuration)

Arguments

pdata

data.frame

config

AnalysisConfiguration

Examples



istar <- sim_lfq_data_peptide_config()
#> creating sampleName from fileName column
#> Warning: no nr_children column specified in the data, adding column nr_children and setting to 1.
#> completing cases


xx <- table_factors(istar$data,istar$config )
xx
#> # A tibble: 12 × 3
#>    sample  sampleName group_
#>    <chr>   <chr>      <chr> 
#>  1 A_V1    A_V1       A     
#>  2 A_V2    A_V2       A     
#>  3 A_V3    A_V3       A     
#>  4 A_V4    A_V4       A     
#>  5 B_V1    B_V1       B     
#>  6 B_V2    B_V2       B     
#>  7 B_V3    B_V3       B     
#>  8 B_V4    B_V4       B     
#>  9 Ctrl_V1 Ctrl_V1    Ctrl  
#> 10 Ctrl_V2 Ctrl_V2    Ctrl  
#> 11 Ctrl_V3 Ctrl_V3    Ctrl  
#> 12 Ctrl_V4 Ctrl_V4    Ctrl  
xt <- xx |> dplyr::group_by(!!!rlang::syms(istar$config$table$factor_keys())) |>
 dplyr::summarize(n = dplyr::n())
xt
#> # A tibble: 3 × 2
#>   group_     n
#>   <chr>  <int>
#> 1 A          4
#> 2 B          4
#> 3 Ctrl       4
stopifnot(all(xt$n == 4))