| | |
| | |
| |
|
| | .libPaths(c("rlib/", .libPaths())) |
| |
|
| | if (!suppressPackageStartupMessages(require("pacman"))) { install.packages("pacman") } |
| |
|
| | pacman::p_load( |
| | here, |
| | tidyverse, |
| | reshape2, |
| | broom, |
| | glue, |
| | forcats, |
| | magrittr, |
| | stringr, |
| | purrr, |
| | rcompanion, |
| | naniar, |
| | readr, |
| | tidyr, |
| | dplyr, |
| | openxlsx, |
| | jsonlite, |
| | readxl, |
| | flextable, |
| | officer, |
| | |
| | |
| | |
| | sp, |
| | scico, |
| | BiocManager, |
| | foreach, |
| | |
| | MASS, |
| | matrixStats, |
| | |
| | |
| | |
| |
|
| | |
| | missForest, |
| | |
| | |
| | scales, |
| | RColorBrewer, |
| | ggpubr, |
| | ggplot2, |
| | ggrepel, |
| | gplots, |
| | ggtree, |
| | ggridges, |
| | grid, |
| | gridExtra, |
| | scales, |
| | ggmap, |
| | psych, |
| | viridis, |
| | rlang, |
| | devtools, |
| | patchwork, |
| | ggnewscale, |
| | ggstance, |
| | |
| | |
| | mapdata, |
| | maptools, |
| | maps, |
| | |
| | geosphere, |
| | fields, |
| | |
| | |
| | ape, |
| | phytools, |
| | nlme, |
| | caper, |
| | MCMCglmm, |
| |
|
| | |
| | |
| | assertthat, |
| | beepr |
| | ) |
| |
|
| | |
| | options(tidyverse.quiet = TRUE) |
| | options(warn.conflicts = FALSE) |
| | options(stringsAsFactors = FALSE) |
| |
|
| | GRAMBANK_LANGUAGES <- file.path("../..", "cldf", "languages.csv") |
| | GRAMBANK_VALUES <- file.path("../..", "cldf", "values.csv") |
| | GRAMBANK_PARAMETERS <- file.path("../..", "cldf", "parameters.csv") |
| | GRAMBANK_CODES <- file.path("../..", "cldf", "codes.csv") |
| |
|
| | |
| | VALUES_COLSPEC <- c( |
| | ID = col_character(), |
| | Language_ID = col_character(), |
| | Parameter_ID = col_character(), |
| | Value = col_character(), |
| | Code_ID = col_character(), |
| | Comment = col_character(), |
| | Source = col_character() |
| | ) |
| |
|
| | LANGUAGES_COLSPEC = c( |
| | ID = col_character(), |
| | Name = col_character(), |
| | Macroarea = col_character(), |
| | Latitude = col_double(), |
| | Longitude = col_double(), |
| | Glottocode = col_character(), |
| | ISO639P3code = col_character(), |
| | contributed_datapoints = col_character(), |
| | provenance = col_character(), |
| | Family_name = col_character(), |
| | Family_id = col_character() |
| | ) |
| |
|
| | PARAMETERS_COLSPEC = c( |
| | ID = col_character(), |
| | Name = col_character(), |
| | Description = col_character(), |
| | patron = col_character(), |
| | name_in_french = col_character(), |
| | Grambank_ID_desc = col_character(), |
| | bound_morphology = col_character() |
| | ) |
| |
|
| | CODES_COLSPEC = c( |
| | ID = col_character(), |
| | Parameter_ID = col_character(), |
| | Name = col_character(), |
| | Description = col_character() |
| | ) |
| |
|
| | WIDE_COLSPEC = c( |
| | .default = col_integer(), |
| | Language_ID = col_character(), |
| | na_prop = col_double() |
| | ) |
| |
|
| | |
| | OUTPUTDIR_models <- here("output_models") |
| | |
| | if (!dir.exists(OUTPUTDIR_models)) { dir.create(OUTPUTDIR_models) } |
| |
|
| | OUTPUTDIR_tables <- here("output_tables") |
| | |
| | if (!dir.exists(OUTPUTDIR_tables)) { dir.create(OUTPUTDIR_tables) } |
| |
|
| | OUTPUTDIR_output <- here("output") |
| | |
| | if (!dir.exists(OUTPUTDIR_output)) { dir.create(OUTPUTDIR_output) } |
| |
|
| | OUTPUTDIR_data_wrangling<- here("data_wrangling") |
| | |
| | if (!dir.exists(OUTPUTDIR_data_wrangling)) { dir.create(OUTPUTDIR_data_wrangling) } |
| |
|
| | OUTPUTDIR_models_reduced <- here("output_models_reduced") |
| | |
| | if (!dir.exists(OUTPUTDIR_models_reduced)) { dir.create(OUTPUTDIR_models_reduced) } |
| | OUTPUTDIR_tables_reduced <- here("output_tables_reduced") |
| | |
| | if (!dir.exists(OUTPUTDIR_tables_reduced)) { dir.create(OUTPUTDIR_tables_reduced) } |
| | OUTPUTDIR_output_reduced <- here("output_reduced") |
| | |
| | if (!dir.exists(OUTPUTDIR_output_reduced)) { dir.create(OUTPUTDIR_output_reduced) } |
| |
|
| | |
| | source("varcov.spatial_function.R") |
| |
|
| | |
| | pcprior_hyper = list(prec =list(prior="pc.prec", param = c(1, 0.1))) |
| |
|