将R中的表导出为带有超链接的HTML

and*_*ewj 3 html r

虽然这里更普遍地考虑了这个问题:

将R表导出为HTML

我特别想知道如何将数据框中的文本显示为.html文件中的超链接.我正在使用这个R2HTML包.

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')
Run Code Online (Sandbox Code Playgroud)

在上面的例子中,我希望http://nytimes.com等等在foo.html文件中显示为超链接.

如果我错过了一些明显的东西,我会道歉

Ram*_*ath 8

这是一个使用的解决方案 googleVis

foo <- transform(foo, url = paste('<a href = ', shQuote(url), '>', url, '</a>')) 
x = gvisTable(foo, options = list(allowHTML = TRUE))
plot(x)
Run Code Online (Sandbox Code Playgroud)