-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeatures.Rmd
executable file
·50 lines (43 loc) · 1.45 KB
/
features.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
---
title: "Features"
output:
html_document:
include:
in_header: ./html/header_features.html
---
***
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE)
library(tidyverse)
library(DT)
dtable <- read_tsv("./data/features.csv") # table with features
tdtable <- read_tsv("./data/topics.csv") #table with topics
colnames(tdtable) <- c('major_topic', 'topic_author', 'topic_filename')
full_join(dtable, tdtable) %>%
filter(filename != 'in progress') %>%
mutate(area = factor(area)) %>%
mutate(major_topic = factor(major_topic)) ->
dtable
#add links to the titles
dtable %>%
mutate(filename = paste0(sprintf(paste0("%0", nchar(length(id)), "d_"), seq_along(id)),
filename),
feature = paste(title, '<br>', '<a href=', filename, '.html>', 'Chapter', '</a>', '|',
'<a href=', filename, '_map.html>', 'Maps&Data', '</a>',
sep = '')) %>%
mutate(major_topic = ifelse(!is.na(topic_filename), paste('<a href=', topic_filename, '.html>', major_topic, '</a>', sep = ''), '')) %>%
select(c(feature, author, major_topic, area))-> dtable
```
``` {r}
# generate searchable datatable
DT::datatable(dtable,
filter = 'top',
escape = FALSE,
rownames = FALSE,
options = list(
pageLength = 150,
autoWidth = TRUE,
dom = 'fltpi')
)
```
***