Apply a function along edges within a pfc
object
pf_edge_apply.Rd
Features of the returned pfc
will be the output of the function applied
to the original features. Therefore the functionm provided must return a
vector the same length of the input.
Examples
## average features of descendents of each edge as a pfc:
pf_edge_apply(pf_desc(pf_indexes(rpfc(100))), function(x) rep(mean(x), length(x)))
#> <pfc<e:198>[198]>
#> First 10 phylogenetic flows:
#> [1] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 13.5──→ Node96
#>
#> [2] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 13.5──→ Node96
#>
#> [3] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 15.2──→ Node29 ── 17.5──→ Node60
#>
#> [4] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 15.2──→ Node29 ── 17.5──→ Node60
#>
#> [5] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 15.2──→ Node29 ── 19.3──→ Node36 ── 21.5──→ Node40
#>
#> [6] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 15.2──→ Node29 ── 19.3──→ Node36 ── 21.5──→ Node40
#>
#> [7] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 15.2──→ Node29 ── 19.3──→ Node36 ── 23.2──→ Node71
#>
#> [8] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 15.2──→ Node29 ── 19.3──→ Node36 ── 23.2──→ Node71 ── 25.2──→ Node72
#>
#> [9] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 15.2──→ Node29 ── 19.3──→ Node36 ── 23.2──→ Node71 ── 25.2──→ Node72 ── 27.5──→ Node86
#>
#> [10] ◎── 3.8──→ Node3 ── 5.9──→ Node5 ── 7.5──→ Node7 ── 9.7──→ Node14 ── 11.2──→ Node26 ── 15.2──→ Node29 ── 19.3──→ Node36 ── 23.2──→ Node71 ── 25.2──→ Node72 ── 27.5──→ Node86