1
我試圖在表格中創建超鏈接並調整列以包裝文本並生成pdf。在表格中創建超鏈接並調整列以包裝文本Rmarkdown
例表:
variable<-"testing a long column to wrap testing a long column to wrap "
col1<-"\href{https://www.google.co.uk/}{click here}"
col2<-"[click here](https://www.google.co.uk/)"
col3<-"[click here](https://www.google.co.uk/)"
col4<-"[click here](https://www.google.co.uk/)"
col5<-"[click here](https://www.google.co.uk/)"
test<-data.frame(variable,col1,col2,col3,col4,col5)
當我嘗試了以下它正確地給出了超鏈接,但不調整列寬
library(kableExtra)
knitr::kable(test,row.names=FALSE) %>%
column_spec(1, width = "5cm")
但是,當我與包括試圖format ='latex'
然後超鏈接不工作,但列寬和包裝文本
library(kableExtra)
knitr::kable(test,format ='latex' ,row.names=FALSE) %>%
column_spec(1, width = "5cm")
請幫忙我添加超鏈接並調整Rmarkdown中的列寬。
太棒了@霍。這正是我所追求的。非常感謝你回答! – Shana