Skip to content

Commit

Permalink
Merge pull request #14 from appliedepi/epirhandbook_data
Browse files Browse the repository at this point in the history
epirhandbook datasets
  • Loading branch information
aspina7 authored Sep 23, 2024
2 parents 0160e4b + 33e039c commit 309fd7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Binary file modified inst/extdata/tableoftables.xlsx
Binary file not shown.
19 changes: 16 additions & 3 deletions vignettes/available-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,20 @@ for data sets in other languages available in the package.

```{r}
# define current language of interest
curr_lang <- "en"
# Load the data
table_of_tables <- rio::import(system.file("extdata", "tableoftables.xlsx",
package = "appliedepidata"))
# Replace the language column with clickable links using the `name` for URLs
table_of_tables <- table_of_tables |>
dplyr::mutate(
og_language = language,
language = paste0('<a href="https://appliedepi.github.io/appliedepidata/reference/',
name, '.html" target="_blank">', language, '</a>'))
# Group by unique_identifier, description, and group_identifier to combine languages
find_langs <- table_of_tables |>
Expand All @@ -34,16 +44,19 @@ find_langs <- table_of_tables |>
# Join with the original data to retain 'name' and handle suffixes
output <- table_of_tables |>
dplyr::filter(language == "en") |>
dplyr::filter(og_language == curr_lang) |>
dplyr::select(unique_identifier, name, description, group_identifier) |>
dplyr::left_join(find_langs, by = "unique_identifier") |>
dplyr::select(name, description, language, group_identifier)
# Create an interactive table with reactable
reactable::reactable(output,
searchable = TRUE,
searchable = FALSE,
filterable = TRUE,
pagination = TRUE,
defaultPageSize = 10)
defaultPageSize = 10,
columns = list(
language = reactable::colDef(html = TRUE) # Enable HTML rendering for links
))
```

0 comments on commit 309fd7b

Please sign in to comment.