0

I have a data frame with with some data to plot and also a link to a website.

I want to create an r markdown document with a graph in the left column and a link and maybe some more text and stats in the right column. For the next line in the data frame, I start a new column in the table.

df <- data.frame(yval=c(1,2,3), links=c('http://u.com/1.html','http://u.com/2.html','http://u.com/3.html'))
for(line in seq(nrow(df))) {
  ggplot(df[line,], aes(x=factor(1),y=yval)) + geom_bar(stat='identity')
  print(df[line,'links'])
}

Actually, the table would be nice to have, I could also life with just image, link, image, link... But actually I have no idea how to produce a link out of my for loop and also creating the plot in the same loop.

drmariod
  • 11,106
  • 16
  • 64
  • 110
  • 1
    this stack overflow question has two answers, one using `knitr` templates, and another printing out the HTML. http://stackoverflow.com/questions/19237190/2-column-report-in-r-markdown-render-html-aside-data-frame – ano Oct 05 '15 at 16:34
  • @ano Uhhh, the link looks like a real dirty hack but works fine... – drmariod Oct 06 '15 at 06:01
  • agree! to quote the original answer, "terribly hacky and you might feel like a bad person for doing it" – ano Oct 06 '15 at 15:34

0 Answers0