-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path_load-data.qmd
More file actions
51 lines (45 loc) · 1.83 KB
/
Copy path_load-data.qmd
File metadata and controls
51 lines (45 loc) · 1.83 KB
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
```{r}
#| label: load-data
library(dplyr)
# library(tidyr)
library(stringr)
# library(purrr)
# library(readr)
# library(glue)
# library(jsonlite)
library(redivis)
# project <- redivis::user("datapages")$dataset("irw_meta:bdxt:v1_1")
# metadata_table <- project$table("metadata")
# # get metadata table
# metadata <- metadata_table$to_tibble()
# metadata <- metadata |>
# mutate(partition = if_else(n_categories == 2, "dichotomous", "polytomous"))
biblio <- redivis$user("datapages")$dataset("irw_meta:bdxt:latest")$table("biblio")$to_tibble()
# First in the R section, we need to properly define the data for OJS
data_index <- biblio |>
rename(dataset = `table`, url = URL__for_data_, license = `Derived_License`,
description = Description, reference = Reference_x, doi = DOI__for_paper_) |>
mutate(dataset = str_remove(dataset, ".R.ata$")) |>
arrange(dataset)
# Make it available to OJS
ojs_define(data_index = data_index)
# Build table → Redivis dataset reference map for embed URL construction
irw_ds <- list(
list(name = "item_response_warehouse", ref = "item_response_warehouse:as2e"),
list(name = "item_response_warehouse_2", ref = "item_response_warehouse_2:epbx"),
list(name = "item_response_warehouse_3", ref = "item_response_warehouse_3:5xaj"),
list(name = "item_response_warehouse_4", ref = "item_response_warehouse_4:980f"),
list(name = "item_response_warehouse_5", ref = "item_response_warehouse_5:3ykx"),
list(name = "item_response_warehouse_6", ref = "item_response_warehouse_6:fpe6")
)
table_ds_ref <- do.call(rbind, lapply(irw_ds, function(ds) {
tabs <- redivis$user("datapages")$dataset(ds$name)$list_tables()
data.frame(
table = tolower(sapply(tabs, function(t) t$name)),
ds_ref = ds$ref,
stringsAsFactors = FALSE
)
}))
ojs_define(table_ds_ref = table_ds_ref)
# ojs_define(metadata = metadata)
```