forked from paulcbauer/apis_for_social_scientists_a_review
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.Rmd
137 lines (95 loc) · 5.1 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
title: "<center>APIs for social scientists:<br>A collaborative review</center>"
author: "<center><h5><blue>Current editors:</blue><br>Paul C. Bauer, Camille Landesvatter, Lion Behrens<br><br><blue>Authors & contributors:</blue><br>Paul C. Bauer, Jan Behnert, Lion Behrens, Chung-hong Chan, Bernhard Clemm von Hohenberg, Lukas Isermann, Philipp Kadel, Melike N. Kaplan, Jana Klein, Markus Konrad, Barbara K. Kreis, Dean Lajic, Camille Landesvatter, Madleen Meier-Barthold, Ondrej Pekacek, Pirmin Stöckle, Malte Söhren, Domantas Undzėnas</h5></center>"
date: '<center><h5><blue>First public version:</blue> 29 November, 2021<br><blue>This version:</blue> `r format(Sys.time(), "%d %B, %Y")`</h5></center>'
site: bookdown::bookdown_site
output: bookdown::gitbook
documentclass: book
bibliography: ["references_overall.bib"]
biblio-style: apalike
link-citations: yes
mainfont: cochineal
sansfont: Linux Biolinum O
description: "This book provides an introduction to different APIs that may be useful to social scientists."
---
```{r functions-not-run, eval=FALSE, include=FALSE}
# FUNCTION: ORDER CHAPTERS ALPHABETICALLY
# Hong's function to order chapters alphabetically
# Use this to reorder chapters alphabetically
require(fs)
require(stringr)
require(purrr)
all_rmds <- dir_ls(regexp = "^[0-9].+[rR]md$")
old_chap_numbers <- str_extract(all_rmds, "^[0-9]+")
new_chap_numbers <- rep(NA, length(old_chap_numbers))
fixed_loc <- old_chap_numbers %in% c("01", "02", "99")
new_chap_numbers[fixed_loc] <- old_chap_numbers[fixed_loc]
chap_names <- str_extract(all_rmds, "[A-zA-Z_]+")
new_chap_numbers[!fixed_loc] <- formatC(match(chap_names[!fixed_loc], sort(chap_names[!fixed_loc])) + 2, width = "2", flag = "0")
gen_fname <- function(x, y) {
paste0(x, "-", y, ".Rmd")
}
new_rmd_names <- map2_chr(new_chap_numbers, str_to_title(chap_names), gen_fname)
file_move(all_rmds, new_rmd_names)
```
```{r functions-run, include=FALSE}
# FUNCTION:
#setwd("~/dev/apis_for_social_scientists_a_review")
.gen_pacman_chunk <- function(x = NULL) {
if (is.null(x)) {
file_name <- knitr::current_input()
} else {
file_name <- stringr::str_subset(dir(), x)[1]
}
lines_text <- readLines(file_name)
packages <- gsub("library\\(|\\)", "",
unlist(stringr::str_extract_all(lines_text,
"library\\([a-zA-z0-9]*\\)|p_load\\([a-zA-z0-9]*\\)")))
packages <- packages[packages!="pacman"]
packages <- packages[packages!="p_load("]
packages <- paste("# install.packages('pacman')", "library(pacman)", "p_load('", paste(packages, collapse="', '"), "')",sep="")
packages <- stringr::str_wrap(packages, width = 80)
packages <- gsub("install.packages\\('pacman'\\)", "install.packages\\('pacman'\\)\n", packages)
packages <- gsub("library\\(pacman\\)", "library\\(pacman\\)\n", packages)
cat(packages)
invisible(x)
}
#.gen_pacman_chunk("Crowdtangle")
#> # install.packages('pacman')
#> library(pacman)
#> p_load('httr', 'devtools',
#> 'RCrowdTangle', 'dplyr', 'jsonlite')
#.gen_pacman_chunk("Facebook_ads")
.gen_checkpoint_chunk <- function(x = NULL) {
if (is.null(x)) {
file_name <- knitr::current_input()
} else {
file_name <- stringr::str_subset(dir(), x)[1]
}
lines_text <- readLines(file_name)
packages <- gsub("library\\(|\\)", "",
unlist(stringr::str_extract_all(lines_text,
"library\\([a-zA-z0-9]*\\)|p_load\\([a-zA-z0-9]*\\)")))
packages <- packages[packages!="pacman"]
packages <- packages[packages!="p_load("]
packages <- paste("# install.packages('checkpoint')", "library(checkpoint)", "checkpoint('", Sys.Date(), "')", sep="")
packages <- stringr::str_wrap(packages, width = 80)
packages <- gsub("install.packages\\('checkpoint'\\)", "install.packages\\('checkpoint'\\)\n", packages)
packages <- gsub("library\\(checkpoint\\)", "library\\(checkpoint\\)\n", packages)
cat(packages)
invisible(x)
}
```
<!-- compile with
bookdown::render_book("index.Rmd", "bookdown::gitbook")
bookdown::publish_book(
name = "apis_for_social_scientists",
account = "paul",
server = "bookdown.org",
render = c("none")
)
-->
# Preface {-}
The present online book provide a review of APIs that may be useful for social scientists. Please start by reading the [Introduction]. The material was/is being developed by various contributors that you can find above and in the contributor section of the corresponding [github repository](https://github.com/paulcbauer/apis_for_social_scientists_a_review). If you are interested in contributing please check out the Section [How to contribute](https://github.com/paulcbauer/apis_for_social_scientists_a_review#how-to-contribute) in the github README.
The material is licensed under a [Apache License 2.0](https://en.wikipedia.org/wiki/Apache_License) license. Where we draw on other authors material other licenses may apply. We are extremely grateful for feedback and if you find errors please let us know.
This document was generated with [R](https://www.r-project.org/), [RMarkdown](http://rmarkdown.rstudio.com/) and [Bookdown](https://bookdown.org/).