-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
17,458 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
dbs/database.eamena/data/reference_data/mds/field-description.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
library(readxl) | ||
library(DT) | ||
library(htmlwidgets) | ||
|
||
## Generates a DT table of field names and field description from 'mds-template.xlsx' | ||
|
||
mds.path <- "C:/Rprojects/eamena-arches-dev/dbs/database.eamena/data/reference_data/mds/" | ||
mds.template <- paste0(mds.path, "mds-template.xlsx") | ||
df <- read_excel(mds.template, sheet = 1) | ||
df_filtered <- df[, c("level1", "level2", "level3", "description", "color")] | ||
colnames(df_filtered)[colnames(df_filtered) == 'level3'] <- 'Heritage Place field' | ||
# rm the transparency from colors (ie, mds) | ||
df_filtered$color <- sub("^(.{7}).*", "\\1", df_filtered$color) | ||
# df_filtered$color <- as.factor(df_filtered$color) | ||
dt_widget <- datatable(df_filtered[ , c("Heritage Place field","description"), drop=FALSE], | ||
rownames = FALSE, | ||
options = list(pageLength = 25, autoWidth = TRUE)) %>% | ||
formatStyle( | ||
columns = c("Heritage Place field"), | ||
backgroundColor = styleEqual(df_filtered[["Heritage Place field"]], df_filtered$color) | ||
) | ||
saveWidget(dt_widget, paste0(mds.path, '/fields-description.html'), selfcontained = TRUE) |
Oops, something went wrong.