www.tuhocr.comCode để tự động liệt kê tài liệu R
Khi các bạn host lên Github thì có thể chèn link để chỉ đến trực tiếp
trang sách cần tham khảo. Ví dụ
https://tuhocr.netlify.app/r-intro.pdf#page=69
Đặc điểm đồ thị base-R graphics
library(knitr)
library(tidyverse)
library(kableExtra)
ok <- list.files("Folder chứa file pdf và hình trang bìa")
river <- paste0("Link host file pdf", ok)
file_pdf <- grep(pattern = ".pdf", x = river, value = TRUE)
file_image <- grep(pattern = ".jpg|.png", x = river, value = TRUE)
## sắp xếp theo thứ tự thời gian
sub("^.*([0-9]{4}).*", "\\1", file_pdf) -> year_published
names(file_pdf) <- year_published
file_pdf[order(names(file_pdf), decreasing = TRUE)] -> file_pdf
sub("^.*([0-9]{4}).*", "\\1", file_image) -> year_published_img
names(file_image) <- year_published_img
file_image[order(names(file_image), decreasing = TRUE)] -> file_image
## đưa thông tin vào table
gsub(pattern = ".pdf", replacement = "", basename(file_pdf)) -> title_ok
my_bib <- data.frame("Bìa sách" = "", "Tên sách" = seq_along(title_ok),
check.names = FALSE)
my_bib$"Title" <- paste0("[", title_ok, "]", "(", ")")
my_bib %>%
kbl(booktabs = T) %>%
kable_paper(full_width = F) %>%
column_spec(1, image = spec_image(
file_image, 200, 250)) %>%
kable_styling(font_size = 20)
## trong file ví dụ này thì link các file pdf được ẩn vì copyright.Tham khảo: