I would like to create a dynamic flow-chart using "Gmisc", "grid", and lists in R.
Basically the code looks as follows:
##############################
library(Gmisc)
library(grid)
# list of names
a.names <- list("i1", "i2", "i3")
# list of boxes
a <- list(boxGrob("item 1"),
boxGrob("item 2"),
boxGrob("item 3")
)
# asigning names to list
names(a) <- a.names
# spreading boxes
b <- spreadHorizontal(a)
names(b) <- (a.names)
# clear view
grid.newpage()
# print boxes spread horizontal
b
Now, a second list of boxes should be aligned vertically along the first box (Item 1).
using
alignHorizontal(reference = b$i1, a) %>% spreadVertical(.from = 0.9, .to=0.6)
results in an error, while
dummy <- b$i2
temp <- alignHorizontal(reference = dummy, a$i1, a$i2)
spreadVertical(temp, .from=0.9, .to=0.6)
works fine, and
dummy <- b$i3
temp <- alignHorizontal(reference = dummy, a)
spreadVertical(temp, .from=0.9, .to=0.6)
results in an error.
Obviously, the alignHorizontal
needs single elements and cannot deal with a list of elements.
Is there any chance to hand over a list of boxes to that function?
Sincerely, Steffen