Plot flow or tree diagram in R

I am relatively new to R and trying to learn some basic courses and trying to solve some of the problems I am running into.

I looked through the forum and google and found what I thought was the solution to my problem, but couldn't get it to work. I have tried the zoo and igraph libraries as well as several others.

I have a data frame with 4 columns and about 2k rows. Each column is populated with factors and contains family, class, subclass, and result (binary converted to coefficient). Hierarchically, they move from the broadest category to the most detailed. I am trying to create a hierarchy of each "family" showing it to descendants and counts at each level for the entire dataframe. Suppose family A has 30 rows. The top box will have an "A" with a score of "30". Under the family "A" we might have 20 in class "A" and 10 in class "B" and so on.

Can anyone provide guidance as to what packages I can use for this? From there I will probably find some tutorials. It seems like it should be a simple problem, but it eludes me.

Thank!

Bill

* EDIT *

user1362215 ... as I mentioned "I searched the forum and google and found that ..." I looked at this package and it was one of the ones I thought this is what I needed, These CRAN docs I find it difficult to understand at times. I have seen this is the "definitive" source, but I tend to find other resources more understandable to me at my level. I have programmed in php, python and a few other languages, but R is the hardest thing for me to dip into for some reason.

MrFlick ... thanks for the link ... here are 10 lines from the sample dataframe ...

> test
   family class subclass outcome
1       A     A        B       0
2       A     A        B       1
3       A     B        A       0
4       B     C        C       0
5       B     B        B       1
6       B     A        B       0
7       C     D        C       1
8       C     C        C       1
9       A     A        A       1
10      B     D        A       0
...
...
...

      

And here is a link to what I am trying to accomplish (the image only has three levels, however, the dataframe has four) ... http://imgur.com/zocWU9d

In the image diagram, the family column will be the first horizontal level, the second will be a subclass of the third (omitted in the diagram) and the outcome of the latter. Hope this becomes clearer. Thanks everyone!

+3


source to share





All Articles