我有一张桌子,我试图放在一张rmarkdown pdf文件中。我也试图格式化表格,以便站点号码是相关网页的可点击链接。
我已经创建了一个函数来将原始表转换为带有rmarkdown格式链接的表。一切正常,除了链接所在的列太大,以至于页面上没有其他列。我尝试更改块详细信息行中图形的宽度,并使用format.args= (width = 15)
更改kable行中表格的宽度。这两个选项都没有改变格式,我没有在网上找到任何类似的问题/答案。这个问题:Including links within Rmarkdown tables (pdf)似乎是相似的,但由于我的表会生成一个长达数百页的表,我希望坚持使用我创建的链接表的方法。
kable功能:
kable(local.select, format = "markdown", row.names= FALSE, format.args= (width = 15))
问题(链接添加到站号时非常宽的列宽,所有其他列都被推离页面):
原始表:
structure(list(Station = structure(1:3, .Label = c("01AF002",
"01AP002", "01AP004"), class = "factor"), FLOW_TYPE = structure(c(1L,
1L, 1L), .Label = "Normal", class = "factor"), Reg. = structure(c(2L,
1L, 1L), .Label = c(" False", " True"), class = "factor"), OperSched = structure(c(1L,
1L, 1L), .Label = " Continuous", class = "factor"), DrainageArea = c(21900L,
668L, 1100L), PEARSEDA = structure(c(1L, 1L, 1L), .Label = "Saint John - St. Croix", class = "factor")), class = "data.frame", row.names = c(NA,
-3L), .Names = c("Station", "FLOW_TYPE", "Reg.", "OperSched",
"DrainageArea", "PEARSEDA"))
链接转换表:
structure(list(`Station Number` = structure(1:3, .Label = c("[01AF002](http://wateroffice.ec.gc.ca/report/report_e.html?mode=Graph&type=h2oArc&stn=01AF002&dataType=Daily¶meterType=Flow&year=2013&scale=normal)",
"[01AP002](http://wateroffice.ec.gc.ca/report/report_e.html?mode=Graph&type=h2oArc&stn=01AP002&dataType=Daily¶meterType=Flow&year=2013&scale=normal)",
"[01AP004](http://wateroffice.ec.gc.ca/report/report_e.html?mode=Graph&type=h2oArc&stn=01AP004&dataType=Daily¶meterType=Flow&year=2013&scale=normal)"
), class = "factor"), `Water Quantity` = structure(c(1L, 1L,
1L), .Label = "Normal", class = "factor"), `Water Flow` = structure(c(2L,
1L, 1L), .Label = c(" False", " True"), class = "factor"), `Sampling Frequency` = structure(c(1L,
1L, 1L), .Label = " Continuous", class = "factor"), `Drainage Area` = c(21900L,
668L, 1100L), PEARSEDA = structure(c(1L, 1L, 1L), .Label = "Saint John - St. Croix", class = "factor")), .Names = c("Station Number",
"Water Quantity", "Water Flow", "Sampling Frequency", "Drainage Area",
"PEARSEDA"), class = "data.frame", row.names = c(NA, -3L))
rmarkdown文档中的原始表格(正如我希望在有与电台名称相关联的链接时显示):
有没有办法将链接放在表中而没有在链接列中创建的额外间距? 谢谢你的任何建议。