-
Notifications
You must be signed in to change notification settings - Fork 2
/
_fields.Rmd
48 lines (38 loc) · 1.57 KB
/
_fields.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
---
output:
rmdformats::readthedown:
self_contained: false
includes:
in_header: GA_Script.html
params:
field_name: "nothing"
cips_headers: "nothing"
cips_content: "nothing"
title: "`r paste0(params$field_name)`"
---
```{r, echo=FALSE, message=FALSE, warning=FALSE, eval=TRUE}
source("_packages.R")
source("R/functions.R")
tar_load(fields_and_majors)
db <- dbConnect(RSQLite::SQLite(), "data/db_IPEDS.sqlite")
field_data <- tbl(db, fields_and_majors[1]) %>% as.data.frame()
dbDisconnect(db)
```
This has all the subfields within "`r params$field_name`". This field is for "`r (params$cips_headers)$CIPDefinition[1]`"
Clicking on a degree name within a table will link to a page for that degree and field combination.
```{r, echo=FALSE, message=FALSE, warning=FALSE, eval=TRUE, results='asis'}
cips_content <- params$cips_content
for (cips_index in sequence(nrow(cips_content))) {
#for (cips_index in sequence(10)) {
focal_data <- field_data %>% dplyr::filter(Field==cips_content$CIPTitle[cips_index])
if(nrow(focal_data)>0) {
focal_data$Degree <- paste0("<a href='majors_", URLEncodeTotal(gsub(" ", "", focal_data$Degree)), "_", URLEncodeTotal( gsub('/', "_",gsub(",", "_", gsub(" ", "", focal_data$Field)))) ,".html'>", focal_data$Degree, "</a>")
cat(paste0("## ", cips_content$CIPTitle[cips_index]))
cat("\n\n")
cat(cips_content$CIPDefinition[cips_index])
cat("\n\n")
cat(focal_data %>% dplyr::select(-Field) %>% knitr::kable(escape=FALSE) %>% kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed")))
cat("\n\n\n\n")
}
}
```