虽然这个问题已经在这里得到了更广泛的研究:
我特别想知道如何让数据框中的文本在 .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')
在上面的示例中,我希望 http://nytimes.com
等在 foo.html
文件中显示为超链接。
如果我遗漏了一些明显的东西,我们深表歉意。
最佳答案
这是一个使用 googleVis
的解决方案
foo <- transform(foo, url = paste('<a href = ', shQuote(url), '>', url, '</a>'))
x = gvisTable(foo, options = list(allowHTML = TRUE))
plot(x)
关于html - 使用超链接将 R 中的表格导出到 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8030208/