Skip to contents

Calculate the class occupancies of all features in an AnalysisData object.

Usage

occupancy(d, cls = "class")

# S4 method for AnalysisData
occupancy(d, cls = "class")

Arguments

d

S4 object of class AnalysisData

cls

sample information column to use for which to compute class occupancies

Value

A tibble containing feature class proportional occupancies.

Examples

library(metaboData)

d <- analysisData(abr1$neg[,200:300],abr1$fact)

occupancy(d,cls = 'day')
#> # A tibble: 596 × 5
#>    day   Feature     N `Class total` Occupancy
#>    <fct> <chr>   <dbl>         <int>     <dbl>
#>  1 1     N200        1            20      0.05
#>  2 1     N201        3            20      0.15
#>  3 1     N202        3            20      0.15
#>  4 1     N203       19            20      0.95
#>  5 1     N204        4            20      0.2 
#>  6 1     N205       17            20      0.85
#>  7 1     N206        4            20      0.2 
#>  8 1     N207        8            20      0.4 
#>  9 1     N208        7            20      0.35
#> 10 1     N209       16            20      0.8 
#> # ℹ 586 more rows