Skip to contents

Coerce a codiv result to a plain data frame

Usage

# S3 method for class 'codiv'
as.data.frame(x, ...)

Arguments

x

A codiv object.

...

Ignored.

Value

A plain data frame with the codiv class and parameter attribute removed.

Examples

# \donttest{
sim <- simulate_codiv_data(n_hosts = 10, n_clades = 3, seed = 1)
res <- codiv(sim$host_tree, sim$symbiont_tree, sim$links,
             methods = "hommola", permutations = 99)
#> Creating unique node labels
#> Of the 59 internal nodes in the symbiont tree,
#>    49 (83%) have span > 0 and <= 10% of max (0 dropped for zero span)
#>    5 (8%) have 7-500 symbiont tips (0 dropped as too large)
#>    5 (8%) have >= 3 hosts
#> Scanning 5 nodes for codiversification.
#> Scanning 5 nodes across 3 cores ...
df <- as.data.frame(res)   # plain data frame for filtering / export
head(df)
#>         Node_ID
#> Node_18 Node_18
#> Node_36 Node_36
#> Node_17 Node_17
#> Node_49 Node_49
#> Node_15 Node_15
#>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Symbiont_Tree
#> Node_18                                                                                                                                                                                        ((c2_h3_1:0.004661357195,c2_h3:0.004661357195)Node_24:0.01087650012,((c2_h10_1:0.001186443053,c2_h10:0.001186443053)Node_23:0.002768367124,((c2_h9_1:0.002584480569,c2_h9:0.002584480569)Node_22:0.006030454661,(c2_h2_1:0.002765316812,c2_h2:0.002765316812)Node_21:0.006452405895)Node_20:0.004002682002)Node_19:0.004072273792)Node_18;
#> Node_36                                                                                                                                                              ((c3_h4_1:0.07625152206,(c3_h4_2:0.02287545662,c3_h4:0.02287545662)Node_43:0.05337606544)Node_42:0.1779202181,((c3_h3_1:0.05618300743,(c3_h3_2:0.01685490223,c3_h3:0.01685490223)Node_41:0.0393281052)Node_40:0.131093684,(c3_h2_1:0.0565443785,(c3_h2_2:0.01696331355,c3_h2:0.01696331355)Node_39:0.03958106495)Node_38:0.1319368832)Node_37:0.05085388256)Node_36;
#> Node_17                                                                                                ((c2_h4_1:0.01835908762,c2_h4:0.01835908762)Node_25:0.04283787112,((c2_h3_1:0.004661357195,c2_h3:0.004661357195)Node_24:0.01087650012,((c2_h10_1:0.001186443053,c2_h10:0.001186443053)Node_23:0.002768367124,((c2_h9_1:0.002584480569,c2_h9:0.002584480569)Node_22:0.006030454661,(c2_h2_1:0.002765316812,c2_h2:0.002765316812)Node_21:0.006452405895)Node_20:0.004002682002)Node_19:0.004072273792)Node_18:0.04606688055)Node_17;
#> Node_49 (((c3_h10_1:0.007972939947,(c3_h10_2:0.002391881984,c3_h10:0.002391881984)Node_59:0.005581057963)Node_58:0.01860352654,(c3_h9_1:0.008837663511,(c3_h9_2:0.002651299053,c3_h9:0.002651299053)Node_57:0.006186364458)Node_56:0.02062121486)Node_55:0.08991485234,((c3_h8_1:0.004766214497,(c3_h8_2:0.001429864349,c3_h8:0.001429864349)Node_54:0.003336350148)Node_53:0.01112116716,(c3_h7_1:0.004478456821,(c3_h7_2:0.001343537046,c3_h7:0.001343537046)Node_52:0.003134919774)Node_51:0.01044973258)Node_50:0.1188468404)Node_49;
#> Node_15        (((c2_h4_1:0.01835908762,c2_h4:0.01835908762)Node_25:0.04283787112,((c2_h3_1:0.004661357195,c2_h3:0.004661357195)Node_24:0.01087650012,((c2_h10_1:0.001186443053,c2_h10:0.001186443053)Node_23:0.002768367124,((c2_h9_1:0.002584480569,c2_h9:0.002584480569)Node_22:0.006030454661,(c2_h2_1:0.002765316812,c2_h2:0.002765316812)Node_21:0.006452405895)Node_20:0.004002682002)Node_19:0.004072273792)Node_18:0.04606688055)Node_17:0.02968134993,(c2_h1_1:0.02884987917,c2_h1:0.02884987917)Node_16:0.06731638474)Node_15;
#>         N_Symbionts Symbiont_Colless Symbiont_Sackin
#> Node_18           8                6              26
#> Node_36           9                6              30
#> Node_17          10               12              38
#> Node_49          12                4              44
#> Node_15          12               20              52
#>                                                                                                                                                                      Host_Tree
#> Node_18                                                                    (((H2:0.01678181851,H3:0.01678181851):0.04468413943,H4:0.06146595794):1.659956878,H10:1.721422836);
#> Node_36                                                                                                     ((H1:0.09053719966,H4:0.09053719966):1.630885636,H10:1.721422836);
#> Node_17                                  (((H2:0.01678181851,H3:0.01678181851):0.04468413943,(H4:0.05480904071,H5:0.05480904071):0.006656917232):1.659956878,H10:1.721422836);
#> Node_49                                                                       (((H2:0.06146595794,H5:0.06146595794):0.5234951044,H6:0.5849610623):0.17989428,H9:0.7648553423);
#> Node_15 ((H1:0.09053719966,((H2:0.01678181851,H3:0.01678181851):0.04468413943,(H4:0.05480904071,H5:0.05480904071):0.006656917232):0.02907124172):1.630885636,H10:1.721422836);
#>         N_Hosts Host_Colless Host_Sackin  Hommola_r Hommola_pvalue TreeDistance
#> Node_18       4            3           9 -0.1790181           0.73    1.0000000
#> Node_36       3            1           5 -0.4922685           0.67          NaN
#> Node_17       5            3          13 -0.2492913           0.80    0.7734456
#> Node_49       4            3           9  0.5514694           0.18    0.0000000
#> Node_15       6            7          19 -0.2673787           0.72    0.8199910
#>         SharedPhylogeneticInfo DifferentPhylogeneticInfo NyeSimilarity
#> Node_18              0.0000000                  3.169925     0.3333333
#> Node_36              0.0000000                  0.000000     0.0000000
#> Node_17              0.7369656                  7.813781     1.0000000
#> Node_49              1.5849625                  0.000000     1.0000000
#> Node_15              0.9708537                 15.639388     1.2500000
#>         JaccardRobinsonFoulds MatchingSplitDistance MatchingSplitInfoDistance
#> Node_18              1.333333                     2                  3.169925
#> Node_36              0.000000                     0                  0.000000
#> Node_17              2.000000                     3                  6.117787
#> Node_49              0.000000                     0                  0.000000
#> Node_15              3.500000                     7                 11.241245
#>         MutualClusteringInfo
#> Node_18            0.0000000
#> Node_36            0.0000000
#> Node_17            0.4399462
#> Node_49            1.0000000
#> Node_15            0.5032583
# }