一般来说,流程图大家比较习惯用 MS 的visio 来实现,或退而求其次使用 MS word 或 Excel 也可以实现相同功能。其实流程图是一种很简单的图形模式,R 的diagram 包也提供了 Flow Chart 功能,只不过使用命令行来实现:
## the R code ##
 
library(diagram)
 
pos <- coordinates(pos=c(3,3,3,3,3,3))
 
cc <- c("Start",LETTERS[2:16],"End")
 
openplotmat(main="Flow Chart")
 
for(i in seq(1,15,by = 3)) straightarrow(from = pos[i,] ,to = pos[i+3,])
 
for(i in c(2,5,8)) straightarrow(from = pos[i,] ,to = pos[i+6,])
 
segmentarrow(from = pos[16,],to=pos[2,],path="RVL",dd=0.15)
 
bentarrow(from = pos[8,], to=pos[6,],path='H')
 
bentarrow(from = pos[6,], to=pos[2,],path='V')
 
straightarrow(from=pos[14,],to = pos[17,])
 
for(i in c(2,7,13,14,16)) textrect(pos[i,],radx=0.08,rady=0.04,lab = cc[i])
 
for(i in c(1,17)) textround(pos[i,],radx=0.08,rady=0.04,lab = cc[i])
 
textdiamond(mid = pos[8,],radx = 0.15,rady = 0.08,lab = c("Has","Detect?"))
 
textmulti(mid = pos[4,],radx=0.1,rady=0.05,nr=6)
 
textmulti(mid = pos[6,],radx=0.1,rady=0.05,nr=5)
 
textellipse(mid = pos[10,],radx = 0.1,rady = 0.05)
 
text(pos[8,1]+0.2,pos[8,2]+0.03,"YES",cex = 0.8)
 
text(pos[11,1]+0.04,pos[11,2],"NO",cex = 0.8)

Flow

相关文章:

  • 没有了,随便看看吧 ^_^

3 回应 到 “在 R 中实现流程图”

  1. Yihui Xie 说:

    跑题一下,你的Space咋不把RSS功能打开呢?

  2. Speedo 说:

    还有个软件作流程图很棒:Graphviz.
    而且和R一样,也是开源的。

  3. Taiyun Wei 说:

    这期的The R Journal似乎有相关的一篇文章。

回复

(必须)

(必须)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

© 2010 刘思喆 @ 贝吉塔行星 Suffusion WordPress theme by Sayontan Sinha