我尝试了下面的代码来提供指向另一个文件的超链接
library(xlsx)
wb <- createWorkbook()
sheet1 <- createSheet(wb, "Sheet1")
rows <- createRow(sheet1, 1:10) # 10 rows
cells <- createCell(rows, colIndex=1:8) # 8 columns
links <- c("D://r datasets/sales data.xlsx")
names(links) <- c("hyperlinks")
for (row in 1:length(links)) {
setCellValue(cells[[row,1]], names(links)[row])
addHyperlink(cells[[row,1]], links[row])
}
saveWorkbook(wb, "links.xlsx")
shell.exec("links.xlsx")
但我收到错误
.jcall(cell, "V", "setHyperlink", link) 中的错误:java.lang.IllegalArgumentException:超链接地址必须是有效的 URI