While this question more generally has been looked at here:
Exporting R tables to HTML
I was wondering specifically how to have text in a data frame appear as a hyperlink in the .html file.  I am using the R2HTML package.
foo <- data.frame(a=c(1,2,3), b=c(4,5,6), 
url=c('http://nytimes.com', 'http://cnn.com', 'http://www.weather.gov'))
HTML(foo, file='foo.html')
In the above example, I'd like the http://nytimes.com, etc. to appear as hyperlinks in the foo.html file.  
Apologies if I am missing something obvious.
Here is a solution using googleVis
foo <- transform(foo, url = paste('<a href = ', shQuote(url), '>', url, '</a>')) 
x = gvisTable(foo, options = list(allowHTML = TRUE))
plot(x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With