draw path-diagram Rgraphvis
0
0
Entering edit mode
RenéMayer ▴ 10
@renemayer-5424
Last seen 10.6 years ago
Dear List, how can I draw the following path diagram A B C D E F # observed x \ | / \ | / G <--> H # latent variables / \ / \ I J K L # observed y the problem I've got is that G and H need to be horizontally alingned but the best I've done is diagonally or vertically alingned, kind regards, Ren? ## Begin: R-code #################################### #source("http://bioconductor.org/biocLite.R") #biocLite("Rgraphviz") library(Rgraphviz) library("graph") # observed x ox=c('RParAsp', 'RIQ', 'RSES','FSES', 'FIQ', 'FParAsp') # observed y oy=c('ROccAsp', 'REdAsp', 'FOccAsp', 'FEdAsp') # latent l=c('FGenAsp','RGenAsp') l1 <- new("graphNEL", nodes = c(ox,oy,l), edgemode = "directed") l1 <- addEdge("RParAsp", "RGenAsp", l1) l1 <- addEdge("RIQ", "RGenAsp", l1) l1 <- addEdge("RSES", "RGenAsp", l1) l1 <- addEdge("FParAsp", "FGenAsp", l1) l1 <- addEdge("FIQ", "FGenAsp", l1) l1 <- addEdge("FSES", "FGenAsp", l1) l1 <- addEdge("FGenAsp", "FOccAsp", l1) l1 <- addEdge("FGenAsp", "FEdAsp", l1) l1 <- addEdge("RGenAsp", "ROccAsp", l1) l1 <- addEdge("RGenAsp", "REdAsp", l1) l1 <- addEdge("RGenAsp", "FGenAsp", l1) l1 <- addEdge("FGenAsp", "RGenAsp", l1) plot(l1, recipEdges="distinct") sub1 <- subGraph(ox, l1) sub2 <- subGraph(oy, l1) sub3 <- subGraph(l, l1) # try to set the rankdir locally, but it is not working sublist <- list( list( graph=sub1, cluster = T, attrs = c(rankdir = 'TB') ), list( graph=sub2, cluster = T, attrs = c(rankdir = 'TB') ), list( graph=sub3, cluster = T, attrs = c(rankdir = 'LR') ) ) plot(l1, subGList = sublist) ## End: R-code ##################################
• 746 views
ADD COMMENT

Login before adding your answer.

Traffic: 840 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6