2017-10-14 10 views
1

J'essaye de reproduire l'organigramme de http://www.consort-statement.org/consort-statement/flow-diagram en utilisant le paquet DiagrammeR de R. Ci-dessous est où je suis allé jusqu'ici, mais je ne peux pas obtenir la boîte "exclue" à aligner horizontalement avec le nœud vide . Aucune suggestion?DiagrammeR et graphviz

`` `{r, echo = FALSE, avertissement = FALSE, résultats = 'cacher', message = FALSE

bibliothèque (Pacman)

p_load (Diagrammer)

grViz (»

digramme a_nice_graph {

noeud [fontname = Helvetica, forme = boîte, largeur = 4, fillColor = lightsalmon, styl e = rempli]

évalué [label = 'en recouvrement pour Elibibility (n =)']

randomisée [= 'randomisé (n =)']

allocatedA [label = « attribué en intervention A (n =) ']

allocatedB [label = 'attribué en intervention B (n =)']

Losta [label = 'perdu pour le suivi (n =)']

los tB [label = 'perdu pour le suivi (n =)']

analyzedA [label = 'analysés (n =)']

analyzedB [label = 'analysés (n =)']

blank [label = '', width = 0.01, height = 0.01]

exclus [label = 'exclus (n =)']

sous-graphe cluster_0 {

rankdir = TD 

color = white 

assessed -> blank [arrowhead = none] 

blank -> randomized 

}

sous-graphe cluster_1 {

rankdir = LR 

color = white 

blank -> excluded 

}

randomisés -> {allocatedA allocatedB}

allocatedA -> Losta

allocatedB -> lostB

Losta -> analyzedA

lostB -> analyzedB

}

")

`` `

Voici l'intrigue résultant jusqu'ici:

enter image description here

Répondre

1

Je ne suis pas en utilisant RMarkdown mais ai vérifié avec le navigateur, je crois que cela devrait fonctionner « comme il est » dans votre configuration ainsi . Le point est juste mettre blank et excluded dans le même rang. Pas besoin de les sous-graphes vous avez essayé:

digraph a_nice_graph 
{ 
    node [fontname = Helvetica, shape = box, width = 4, fillcolor = LightSalmon, style = filled] 
    assessed [label = 'Assessed for Elibibility (n =)'] 
    randomized [label = 'Randomized (n =)'] 
    allocatedA [label = 'Allocated to intervention A (n =)'] 
    allocatedB [label = 'Allocated to intervention B (n =)'] 
    lostA [label = 'Lost to follow-up (n =)'] 
    lostB [label = 'Lost to follow-up (n =)'] 
    analyzedA [label = 'Analyzed (n =)'] 
    analyzedB [label = 'Analyzed (n =)'] 
    blank[label = '', width = 0.01, height = 0.01] 
    excluded[label = 'Excluded (n =)'] 

    { rank = same; blank excluded } 

    assessed -> blank[ dir = none ]; 
    blank -> excluded[ minlen = 3 ]; 
    blank -> randomized; 
    randomized -> {allocatedA allocatedB}; 
    allocatedA -> lostA; 
    allocatedB -> lostB; 
    lostA -> analyzedA; 
    lostB -> analyzedB; 
} 

cède

enter image description here

+0

Merci une tonne, exactement ce que je avais besoin –