I have a data frame
df = data.frame("A" = c("a","b, c","c","d, e, f"), "B" = c(1,2,3,4), "link" = c("www.a.com", "www.b.com, www.c.com", "www.c.com", "www.d.com, www.e.com, www.f.com"))
A B link
a 1 www.a.com
b,c 2 www.b.com, www.c.com
c 3 www.c.com
d,e,f 4 www.d.com, www.e.com, www.f.com
I make the format table
dt.ft <- regulartable(data = dt[, list(A, B, link)])
I want to have the values in column "A" hyperlinked with corresponding values in "link" column, which I did with the help of @DavidGohel using following command
dt.ft <- flextable(data = df, col_keys = c("A", "B"))
dt.ft <- compose(x = dt.ft, j = 1, value = as_paragraph( hyperlink_text(x = A, url = link)))
d
That works fine. But as you can see there are comma separated values in column "A" and comma separated links in "link" column. How can I make the correspsoding hyperlink and show in the same cell So, the flextable would have a column "A" and second row would have "b" and "c" hyperlinked to "www.b.com" and "www.c.com"
If there is any other alternative to design the DF, I can do that. Its just I have dynamic content and it would vary from different values, ie. i wouldnt know the number of the links prior hand.
As of now, that is not possible. The way around would be the create multiple rows with similar content, except for the link and link value and then merge these rows. that way you would have multiple hyperlinks in vertical order for a merged row.