Functions to Change the orientation of MiCo Input Data
pivotMiCo.Rd
Wrapper function around tidyr's pivot_longer()
function to facilitate
the easy transformation into the correct data format for MiCo construction.
Examples
tb <- tibble::tribble(
~uptake, ~secretion, ~flux, ~species,
"m1", "m2", 1, "s1",
"m2", "m3", 1, "s2",
"m3", "m4", 1, "s3",
"m4", "m1", 1, "s4")
pivotMiCo(
tb = tb,
species = "species",
from = "uptake",
to = "secretion",
flux = "flux")
#> # A tibble: 8 × 3
#> species metabolite flux
#> <chr> <chr> <dbl>
#> 1 s1 m1 -1
#> 2 s1 m2 1
#> 3 s2 m2 -1
#> 4 s2 m3 1
#> 5 s3 m3 -1
#> 6 s3 m4 1
#> 7 s4 m4 -1
#> 8 s4 m1 1