library(dplyr); library(knitr); library(kableExtra);
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Attaching package: 'kableExtra'
The following object is masked from 'package:dplyr':
group_rows
library(tidyr); library(stringr)
options(knitr.kable.NA = '')
Simple table manually generated
df <- data.frame(a = c(1, 2),
b = c("[CRAN](https://cran.r-project.org)", "https://github.com"))
knitr::kable(df)
a |
b |
1 |
[CRAN](https://cran.r-project.org) |
2 |
https://github.com |
My example of an auto generated name
hw <- data.frame(filenames = paste0('hw/', list.files("hw", pattern='template|*.pdf|*.html|*.docx')))
out.hw <- hw %>% mutate(name = gsub("hw/|_template", "", filenames),
type = str_extract(hw$filenames,".{3}$"),
type = ifelse(type=="tml", "html", type),
type = ifelse(type=="ocx", "docx", type),
nam = gsub(".html|.pdf|.Rmd|.docx", "", name),
link = sprintf("[%s](%s)",type, filenames))
x = out.hw %>% select(link, type, nam) %>%
reshape2::dcast(nam~type, value.var="link") %>%
kable(format="html", escape=TRUE) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive" ,"bordered"),
full_width=FALSE, position = "left")
gsub("<thead>.*</thead>", "", x)
hw00_setup |
|
[html](hw/hw00_setup.html) |
[pdf](hw/hw00_setup.pdf) |
hw01_data_entry |
[docx](hw/hw01_data_entry.docx) |
[html](hw/hw01_data_entry.html) |
[pdf](hw/hw01_data_entry.pdf) |
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.4.0 tidyr_1.2.0 kableExtra_1.3.4 knitr_1.39
[5] dplyr_1.0.9
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 plyr_1.8.7 highr_0.9 pillar_1.8.0
[5] compiler_4.2.1 tools_4.2.1 digest_0.6.29 viridisLite_0.4.0
[9] jsonlite_1.8.0 evaluate_0.15 lifecycle_1.0.1 tibble_3.1.8
[13] pkgconfig_2.0.3 rlang_1.0.4 cli_3.3.0 DBI_1.1.3
[17] rstudioapi_0.13 yaml_2.3.5 xfun_0.31 fastmap_1.1.0
[21] httr_1.4.3 xml2_1.3.3 systemfonts_1.0.4 generics_0.1.3
[25] vctrs_0.4.1 htmlwidgets_1.5.4 webshot_0.5.3 tidyselect_1.1.2
[29] svglite_2.1.0 glue_1.6.2 R6_2.5.1 fansi_1.0.3
[33] rmarkdown_2.14 reshape2_1.4.4 purrr_0.3.4 magrittr_2.0.3
[37] ellipsis_0.3.2 scales_1.2.0 htmltools_0.5.3 assertthat_0.2.1
[41] rvest_1.0.2 colorspace_2.0-3 utf8_1.2.2 stringi_1.7.8
[45] munsell_0.5.0