开发者

Plot a tree diagram from a list in R

I have a decision开发者_JS百科 tree represented as a list in R:

tree = list(
    "Bin type" = list(
        "no bin" = list(
            "SOA linearity" = list(
                "linear" = list("Linear MEM")
                , "non-linear" = list("GAMM")
            )
        )
        , "bin" = list(
            "SOA type" = list(
                "SOA as categorical" = list(
                    "Tool" = list(
                        "ANOVA"
                        , "MEM"
                    )
                )
                , "SOA as continuous" = list(
                    "SOA linearity" = list(
                        "linear" = list(
                            "Tool" = list(
                                "ANOVA"
                                , "MEM"
                            )
                        )
                        , "non-linear" = list("GAMM")
                    )
                )
            )
        )
    )
)

Is there a quick way to visualize this as a tree diagram?


I don't think there's an immediate way, since packages for plotting trees would want a specific data structure for the tree which would unlikely match your list. So likely you'll need to convert your list into another form.

I would look at the igraph package. I'd start with the graph() function; if you could convert your list (describing a tree) to a graph, the igraph package would help you to plot it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜