-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.Rmd
51 lines (42 loc) · 1.13 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: "limnopapers"
output:
flexdashboard::flex_dashboard:
orientation: columns
self_contained: TRUE
vertical_layout: fill
---
```{r setup, include=FALSE}
library(DT)
library(dplyr)
library(stringr)
```
```{r, echo=FALSE, out.width="100%", warning=FALSE}
dt <- read.csv("dashboard.csv")
dt <- dplyr::select(dt, title, source = dc_source, url = prism_url)
# dt$date <- strptime(as.POSIXct(dt$date), format = "%Y-%m-%d")
# dt$date <- format(dt$date, "%Y-%m-%d")
create_link <- function(x) {
# x <- dt$url[1]
if (is.na(x)) {
return("")
} else {
sprintf(paste0('<a href="', URLdecode(x), '" target="_blank">', substr(x, 1, 25), "</a>"))
}
}
dt$url <- lapply(dt$url, function(x) sapply(x, create_link))
dt_table <- DT::datatable(dt,
options = list(
scrollX = TRUE,
autoWidth = TRUE# ,
# columnDefs = list(
# list(width = "30%", targets = c(3)))
),
rownames = FALSE,
fillContainer = TRUE,
width = "100%",
colnames = c("Title", "Source", "URL"))
dt_table <- formatStyle(dt_table, columns = 1:4, fontSize = "80%")
dt_table <- formatStyle(dt_table, columns = 1, width = "500px")
dt_table
```