-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.qmd
52 lines (36 loc) · 1.76 KB
/
README.qmd
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
---
format: gfm
---
![GitHub last commit](https://img.shields.io/github/last-commit/UofUEpiBio/PHS-7045-egga)
# Latest papers on Agent-Based Modeling in PubMed
This repository is an *Example using GitHub Actions* \[egga\] for the Advanced Programming with R class. The project consists of a quarto document updated once a week or whenever there's a push or pull request. It performs a search on PubMed looking for the [latest papers about Agent-Based Models](https://pubmed.ncbi.nlm.nih.gov/?term=agent-based+model&sort=date){target="_blank"}. The last update was on `r Sys.time()`.
```{r}
#| label: data-extract
#| echo: false
library(xml2)
doc <- read_html("https://pubmed.ncbi.nlm.nih.gov/?term=agent-based+model&sort=date")
# Titles
titles <- xml_find_all(doc, xpath = '//*[@class="docsum-title"]')
titles <- xml_text(titles)
titles <- trimws(titles, which = "both")
# Authors
authors <- xml_find_all(doc, xpath = '//*[@class="docsum-authors full-authors"]')
authors <- xml_text(authors)
# Citation
citation <- xml_find_all(doc, xpath = '//*[contains(@class, "full-journal-citation")]')
citation <- xml_text(citation)
# Abstract
abstract <- xml_find_all(doc, xpath = '//*[@class="full-view-snippet"]')
abstract <- xml_text(abstract)
abstract <- trimws(abstract, which = "both") #Removing trailing and leading space
```
```{r}
#| results: asis
#| label: printing
#| echo: false
for (i in 1:length(titles)) {
cat(sprintf("%i. **%s**\n\n %s\n\n %s\n\n >%s\n\n", i, titles[i], authors[i], citation[i], abstract[i]))
}
```
## Code of Conduct
Please note that the PHS-7045-egga project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.