Team Ai
Datasetpublic

SciCodePile/SciCode-Domain-Code

DATA1: Domain-Specific Code Dataset Dataset Overview DATA1 is a large-scale domain-specific code dataset focusing on code samples from interdisciplinary fields such as biology, chemistry, materials science, and related areas. The dataset is collected and organized from GitHub repositories, covering 178 different domain topics with over 1.1 billion lines of code. Dataset Statistics Total Datasets: 178 CSV files Total Data Size: ~115 GB Total Lines… See the full description on the dataset page: https://huggingface.co/datasets/SciCodePile/SciCode-Domain-Code.

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
4likes1.3kdownloads
dataset_Pathogens.csv71921 linesDownload Raw Back to data
1"keyword","repo_name","file_path","file_extension","file_size","line_count","content","language"
2"Pathogens","pat-s/pathogen-modeling","exec-drake.R",".R","945","30","## make targets3 4r_make(r_args = list(show = TRUE))5 6# visualize7 8r_vis_drake_graph(group = ""stage"", clusters = c(""data"", ""task"", ""learner"",9                                                        ""mlr_settings"",10                                                        ""prediction""),11                  targets_only = TRUE, show_output_files = FALSE)12# see outdated13 14r_outdated(r_args = list(show = TRUE))15 16# Misc17r_predict_runtime(r_args = list(show = TRUE))18 19r_predict_workers()20 21 22# Manually ----------------------------------------------------------------23 24make(plan, verbose = 2, targets = c(""maps_debugging_diplodia_no_temp""),25     cache_log_file = ""log/cache_log.txt"",26     console_log_file = ""log/drake.log"",27     lazy_load = ""promise"", caching = ""worker"",28     memory_strategy = ""memory"",29     template = list(log_file = ""log/worker%a.log"", n_cpus= 5, memory = 20000),30     garbage_collection = TRUE, jobs = 2, parallelism = ""clustermq"")31","R"
32"Pathogens","pat-s/pathogen-modeling","tic.R",".R","77","2","do_package_checks(error_on = ""error"", args = c(""--no-tests"", ""--no-manual""))33","R"
34"Pathogens","pat-s/pathogen-modeling","LICENSE.md",".md","1074","22","# MIT License35 36Copyright (c) 2019 Patrick Schratz37 38Permission is hereby granted, free of charge, to any person obtaining a copy39of this software and associated documentation files (the ""Software""), to deal40in the Software without restriction, including without limitation the rights41to use, copy, modify, merge, publish, distribute, sublicense, and/or sell42copies of the Software, and to permit persons to whom the Software is43furnished to do so, subject to the following conditions:44 45The above copyright notice and this permission notice shall be included in all46copies or substantial portions of the Software.47 48THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR49IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,50FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE51AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER52LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,53OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE54SOFTWARE.55","Markdown"
56"Pathogens","pat-s/pathogen-modeling","_drake.R",".R","3358","83","# Plans -----------------------------------------------------------57source(""code/99-packages.R"")58sourceDirectory(""R/"")59 60data_plan = code_to_plan(""code/01-data/data.R"")61task_plan = code_to_plan(""code/01-data/task.R"")62learners_plan = code_to_plan(""code/02-mlr-settings/learner.R"")63resampling_plan = code_to_plan(""code/02-mlr-settings/resampling.R"")64param_set_plan = code_to_plan(""code/02-mlr-settings/param-set.R"")65tune_ctrl_plan = code_to_plan(""code/02-mlr-settings/tune_ctrl_mbo.R"")66tuning_wrapper_plan = code_to_plan(""code/02-mlr-settings/tuning.R"")67source(""code/03-benchmark/aggregate-results.R"")68source(""code/03-benchmark/benchmark.R"")69source(""code/04-prediction/prediction.R"")70visualization_plan = code_to_plan(""code/05-visualization/vis-partitions.R"")71dataset_tables_plan = code_to_plan(""code/05-visualization/create_dataset_tables.R"")72source(""code/06-reports.R"")73 74source(""https://raw.githubusercontent.com/mlr-org/mlr-extralearner/master/R/RLearner_classif_gam.R"")75 76# grouping for visualization77data_plan$stage = ""data""78task_plan$stage = ""data""79learners_plan$stage = ""learner""80resampling_plan$stage = ""mlr_settings""81param_set_plan$stage = ""mlr_settings""82tune_ctrl_plan$stage = ""mlr_settings""83tuning_wrapper_plan$stage = ""learner""84benchmark_plan$stage = ""benchmark""85bmr_aggr_path_resamp_plan$stage = ""benchmark""86bmr_aggr_model_resamp_plan$stage = ""benchmark""87no_extract_plan$stage = ""benchmark""88bm_all_pathogens_plan$stage = ""benchmark""89prediction_prob_plan$stage = ""prediction""90prediction_maps_plan$stage = ""prediction""91reports_plan$stage = ""reports""92visualization_plan$stage = ""visualization""93dataset_tables_plan$stage = ""visualization""94 95# Combine all -------------------------------------------------------------96 97plan = bind_plans(data_plan, task_plan, learners_plan, resampling_plan,98                  param_set_plan, tune_ctrl_plan, tuning_wrapper_plan,99 100                  bmr_aggr_path_resamp_plan,101                  bmr_aggr_model_resamp_plan,102                  bm_all_pathogens_plan,103                  no_extract_plan,104                  benchmark_plan,105 106                  prediction_prob_plan,107                  prediction_maps_plan,108                  reports_plan,109                  visualization_plan,110                  dataset_tables_plan)111 112plan %<>% mutate(stage = as.factor(stage))113 114options(clustermq.scheduler = ""slurm"",115        clustermq.template = ""~/papers/2018-model-comparison/slurm_clustermq.tmpl"")116 117 118### Show log in console119# watch -n .1 tail -n 40 ~/git/pathogen-modeling/drake.log120 121drake_config(plan,122             verbose = 2,123             targets = c(""pathogen_maps_debugging"", ""prediction_pathogens""),124             lazy_load = ""promise"",125             console_log_file = ""log/drake.log"",126             caching = ""worker"",127             template = list(log_file = ""log/worker%a.log"", n_cpus = 16, memory = 60000,128                             job_name = ""paper1""),129             prework = list(quote(set.seed(1, ""L'Ecuyer-CMRG"")),130                            quote(future::plan(future.callr::callr, workers = 10)),131                            quote(parallelStart(132                              mode = ""multicore"", cpus = ignore(16), level = ""mlr.resample""133                            ))134             ),135             garbage_collection = TRUE, jobs = 3, parallelism = ""clustermq"",136             lock_envir = FALSE, keep_going = TRUE137)138","R"
139"Pathogens","pat-s/pathogen-modeling","inst/rsync-jupiter.sh",".sh","2660","50","#! /bin/bash140 141########142# LIFE143########144 145# `pathogen-prediction-maps` --------------- copy pathogen infection prediction PNG maps to LIFE146rsync -rlptDvzog --chown=www-data:www-data --fake-super \147  /mnt/cluster/home/patrick/papers/2018-model-comparison/docs/figure/prediction-pathogens.Rmd/prediction-map* \148  -e ssh patrick@jupiter.geogr.uni-jena.de:/home/www/life-healthy-forest/action-B1-spatial-mapping/pathogen-infection-maps/149 150# `pathogen_prediction_report` ------------ copy pathogen infection report to LIFE151rsync -rlptDvzog --chown=www-data:www-data --fake-super \152  /mnt/cluster/home/patrick/papers/2018-model-comparison/analysis/rmd/pathogens-prediction.html \153  -e ssh patrick@jupiter.geogr.uni-jena.de:/home/www/life-healthy-forest/action-B1-spatial-mapping/154 155# `benchmark_all_pathogens`-------- copy benchmark report all pathogens to LIFE156rsync -rlptDvzog --chown=www-data:www-data --fake-super \157  /mnt/cluster/home/patrick/papers/2018-model-comparison/analysis/rmd/pathogens-performance.html \158  -e ssh patrick@jupiter.geogr.uni-jena.de:/home/www/life-healthy-forest/action-B1-spatial-mapping/159 160########161# paper ""2018-model-comparison""162########163 164# `benchmark_diplodia` ----------- copy benchmark report DIPLODIA to patrick165rsync -rlptDvzog --chown=www-data:www-data --fake-super \166  /mnt/cluster/home/patrick/papers/2018-model-comparison/analysis/rmd/pathogens-performance-diplodia.html \167  -e ssh patrick@jupiter.geogr.uni-jena.de:/home/patrick/2018-model-comparison/168 169# `visualize_partitions` -------------- copy visualization of partitions to patrick170rsync -rlptDvzog --chown=www-data:www-data --fake-super \171  /mnt/cluster/home/patrick/papers/2018-model-comparison/analysis/rmd/visualize-partitions.html \172  -e ssh patrick@jupiter.geogr.uni-jena.de:/home/patrick/2018-model-comparison/173 174# `vis_opt_paths` -------------- copy visualization of optimization paths to patrick175 176rsync -rlptDvzog --chown=www-data:www-data --fake-super \177  /mnt/cluster/home/patrick/papers/2018-model-comparison/analysis/rmd/vis-opt-paths.html \178  -e ssh patrick@jupiter.geogr.uni-jena.de:/home/patrick/2018-model-comparison/179 180# `vis_tuning_effects` -------------- copy visualization of tuning effects to patrick181rsync -rlptDvzog --chown=www-data:www-data --fake-super \182  /mnt/cluster/home/patrick/papers/2018-model-comparison/analysis/rmd/vis-tuning-effects.html \183  -e ssh patrick@jupiter.geogr.uni-jena.de:/home/patrick/2018-model-comparison/184 185# rsync -rlptDvzog --chown=www-data:www-data --fake-super \186#   /mnt/geoinf_web/bi28yuv/LIFE-Healthy-Forest/* \187#   -e ssh patrick@jupiter.geogr.uni-jena.de:/home/www/life-healthy-forest/action-A2-predictor-database/188","Shell"
189"Pathogens","pat-s/pathogen-modeling","inst/99-funs.R",".R","1250","37","##### my.pairs env190the.col.hist <- ""cyan""191 192 193panel.hist <- function(x, col.hist=the.col.hist,194                       cex.cor=NULL,digits=NULL,col=NULL,pch=NULL,cex=NULL,...)195{196  dummy <- is.character(cex.cor) | is.numeric(digits) | is.character(cex) | is.character(pch) | is.character(col)197  usr <- par(""usr""); on.exit(par(usr))198  par(usr = c(usr[1:2], 0, 1.5) )199  h <- hist(x, plot = FALSE)200  breaks <- h$breaks; nB <- length(breaks)201  y <- h$counts; y <- y/max(y)202  rect(breaks[-nB], 0, breaks[-1], y, col=col.hist, ...)203}204 205panel.cor <- function(x, y, digits=2, prefix="""", cex.cor=NULL,206                      col.hist=NULL,207                      col=NULL,pch=NULL,cex=NULL,...)208{209  dummy <- is.character(col.hist) | is.character(cex) | is.character(pch) | is.character(col)210  usr <- par(""usr""); on.exit(par(usr))211  par(usr = c(0, 1, 0, 1))212  r <- abs(cor(x, y, use=""pairwise.complete.obs""))213  txt <- format(c(r, 0.123456789), digits=digits)[1]214  txt <- paste(prefix, txt, sep="""")215  if (is.null(cex.cor)) cex.cor <- 0.8/strwidth(txt)216  #text(0.5, 0.5, txt, cex = cex.cor * r)217  text(0.5, 0.5, txt, cex = cex.cor)218}219 220my_pairs <- function( x, ... )221{222  pairs( x, ...,223         upper.panel=panel.smooth, lower.panel=panel.cor, diag.panel=panel.hist )224}225","R"
226"Pathogens","pat-s/pathogen-modeling","inst/atlas-climatico-new.R",".R","1634","40","library(magrittr)227library(readr)228library(raster)229library(sf)230library(dplyr)231pr_1km_CAPV_Arakil <- read.table(file = ""data/02-pr/pr/pr_1km_CAPV_Arakil.csv"", sep = "","", dec = ""."", header = TRUE)232 233test = tidyr::gather(pr_1km_CAPV_Arakil, ""coord_id"", ""p_sum"", -YYYYMMDD, factor_key = F) %>%234  #dplyr::filter(coord_id != ""X22512"") %>%235  dplyr::rename(date = YYYYMMDD) %>%236  dplyr::mutate(date = as.character(date)) %>%237  dplyr::mutate(date = lubridate::as_date(date)) %>%238  dplyr::filter(date > ""2000-01-01"") %>%239  dplyr::mutate(coord_id = stringr::str_remove(coord_id, ""X"")) %>%240  dplyr::mutate(month = lubridate::month(date)) %>% # create month column (includes all years)241  dplyr::group_by(month, coord_id) %>%242  dplyr::summarise_at(""p_sum"", mean) # get the summarised p_sum for the respective grouping243 244coordinates = readr::read_table2(""data/01_grid_1km_cuencas/grid_1km_cuencas_etrs89/stations_Arakil_etrs89.txt"",245                                 col_type = readr::cols(station_id = col_character()))246 247df_bind = dplyr::left_join(test, coordinates, by = c(""coord_id"" = ""station_id""))248 249df_bind %<>%250  dplyr::rename(x = UTMXetrs89) %>%251  dplyr::rename(y = UTMYetrs89) %>%252  dplyr::mutate(month = as.factor(as.character(month))) %>%253  dplyr::select(x, y, p_sum, month)254 255#df_month = split(df_bind, df_bind$month, drop = FALSE)256 257x = df_bind %>% group_split(month, keep = FALSE)258 259x = map(x, ~ as.data.frame(.x, xy = TRUE))260 261x_st = map(x, ~ st_as_sf(.x, coords = c(""x"", ""y""), crs = 25830))262x_sp = map(x_st, ~ as(.x, ""Spatial""))263x_spdf = map(x_sp, ~ SpatialPixelsDataFrame(.x, tolerance = 0.973816, .x@data))264x_ras = map(x_spdf, ~ raster(.x))265","R"
266"Pathogens","pat-s/pathogen-modeling","man-roxygen/learner.R",".R","50","2","#' @param learner Learner from [mlr::makeLearner]267","R"
268"Pathogens","pat-s/pathogen-modeling","man-roxygen/url.R",".R","52","2","#' @param url URL to download from (usually Zenodo)269","R"
270"Pathogens","pat-s/pathogen-modeling","man-roxygen/task.R",".R","24","2","#' @param task mlr task271","R"
272"Pathogens","pat-s/pathogen-modeling","man-roxygen/param_set.R",".R","34","2","#' @param param_set mlr Param Set273","R"
274"Pathogens","pat-s/pathogen-modeling","man-roxygen/tune_ctrl.R",".R","44","2","#' @param tune_ctrl mrl tune control object275","R"
276"Pathogens","pat-s/pathogen-modeling","man-roxygen/resampling.R",".R","36","2","#' @param resampling mlr resampling277","R"
278"Pathogens","pat-s/pathogen-modeling","packrat/init.R",".R","8406","227","local({279 280  ## Helper function to get the path to the library directory for a281  ## given packrat project.282  getPackratLibDir <- function(projDir = NULL) {283    path <- file.path(""packrat"", ""lib"", R.version$platform, getRversion())284 285    if (!is.null(projDir)) {286 287      ## Strip trailing slashes if necessary288      projDir <- sub(""/+$"", """", projDir)289 290      ## Only prepend path if different from current working dir291      if (!identical(normalizePath(projDir), normalizePath(getwd())))292        path <- file.path(projDir, path)293    }294 295    path296  }297 298  ## Ensure that we set the packrat library directory relative to the299  ## project directory. Normally, this should be the working directory,300  ## but we also use '.rs.getProjectDirectory()' if necessary (e.g. we're301  ## rebuilding a project while within a separate directory)302  libDir <- if (exists("".rs.getProjectDirectory""))303    getPackratLibDir(.rs.getProjectDirectory())304  else305    getPackratLibDir()306 307  ## Unload packrat in case it's loaded -- this ensures packrat _must_ be308  ## loaded from the private library. Note that `requireNamespace` will309  ## succeed if the package is already loaded, regardless of lib.loc!310  if (""packrat"" %in% loadedNamespaces())311    try(unloadNamespace(""packrat""), silent = TRUE)312 313  if (suppressWarnings(requireNamespace(""packrat"", quietly = TRUE, lib.loc = libDir))) {314 315    # Check 'print.banner.on.startup' -- when NA and RStudio, don't print316    print.banner <- packrat::get_opts(""print.banner.on.startup"")317    if (print.banner == ""auto"" && is.na(Sys.getenv(""RSTUDIO"", unset = NA))) {318      print.banner <- TRUE319    } else {320      print.banner <- FALSE321    }322    return(packrat::on(print.banner = print.banner))323  }324 325  ## Escape hatch to allow RStudio to handle bootstrapping. This326  ## enables RStudio to provide print output when automagically327  ## restoring a project from a bundle on load.328  if (!is.na(Sys.getenv(""RSTUDIO"", unset = NA)) &&329      is.na(Sys.getenv(""RSTUDIO_PACKRAT_BOOTSTRAP"", unset = NA))) {330    Sys.setenv(""RSTUDIO_PACKRAT_BOOTSTRAP"" = ""1"")331    setHook(""rstudio.sessionInit"", function(...) {332      # Ensure that, on sourcing 'packrat/init.R', we are333      # within the project root directory334      if (exists("".rs.getProjectDirectory"")) {335        owd <- getwd()336        setwd(.rs.getProjectDirectory())337        on.exit(setwd(owd), add = TRUE)338      }339      source(""packrat/init.R"")340    })341    return(invisible(NULL))342  }343 344  ## Bootstrapping -- only performed in interactive contexts,345  ## or when explicitly asked for on the command line346  if (interactive() || ""--bootstrap-packrat"" %in% commandArgs(TRUE)) {347 348    needsRestore <- ""--bootstrap-packrat"" %in% commandArgs(TRUE)349 350    message(""Packrat is not installed in the local library -- "",351            ""attempting to bootstrap an installation..."")352 353    ## We need utils for the following to succeed -- there are calls to functions354    ## in 'restore' that are contained within utils. utils gets loaded at the355    ## end of start-up anyhow, so this should be fine356    library(""utils"", character.only = TRUE)357 358    ## Install packrat into local project library359    packratSrcPath <- list.files(full.names = TRUE,360                                 file.path(""packrat"", ""src"", ""packrat"")361    )362 363    ## No packrat tarballs available locally -- try some other means of installation364    if (!length(packratSrcPath)) {365 366      message(""> No source tarball of packrat available locally"")367 368      ## There are no packrat sources available -- try using a version of369      ## packrat installed in the user library to bootstrap370      if (requireNamespace(""packrat"", quietly = TRUE) && packageVersion(""packrat"") >= ""0.2.0.99"") {371        message(""> Using user-library packrat ("",372                packageVersion(""packrat""),373                "") to bootstrap this project"")374      }375 376      ## Couldn't find a user-local packrat -- try finding and using devtools377      ## to install378      else if (requireNamespace(""devtools"", quietly = TRUE)) {379        message(""> Attempting to use devtools::install_github to install "",380                ""a temporary version of packrat"")381        library(stats) ## for setNames382        devtools::install_github(""rstudio/packrat"")383      }384 385      ## Try downloading packrat from CRAN if available386      else if (""packrat"" %in% rownames(available.packages())) {387        message(""> Installing packrat from CRAN"")388        install.packages(""packrat"")389      }390 391      ## Fail -- couldn't find an appropriate means of installing packrat392      else {393        stop(""Could not automatically bootstrap packrat -- try running "",394             ""\""'install.packages('devtools'); devtools::install_github('rstudio/packrat')\"""",395             ""and restarting R to bootstrap packrat."")396      }397 398      # Restore the project, unload the temporary packrat, and load the private packrat399      if (needsRestore)400        packrat::restore(prompt = FALSE, restart = TRUE)401 402      ## This code path only reached if we didn't restart earlier403      unloadNamespace(""packrat"")404      requireNamespace(""packrat"", lib.loc = libDir, quietly = TRUE)405      return(packrat::on())406 407    }408 409    ## Multiple packrat tarballs available locally -- try to choose one410    ## TODO: read lock file and infer most appropriate from there; low priority because411    ## after bootstrapping packrat a restore should do the right thing412    if (length(packratSrcPath) > 1) {413      warning(""Multiple versions of packrat available in the source directory;"",414              ""using packrat source:\n- "", shQuote(packratSrcPath))415      packratSrcPath <- packratSrcPath[[1]]416    }417 418 419    lib <- file.path(""packrat"", ""lib"", R.version$platform, getRversion())420    if (!file.exists(lib)) {421      dir.create(lib, recursive = TRUE)422    }423 424    message(""> Installing packrat into project private library:"")425    message(""- "", shQuote(lib))426 427    surround <- function(x, with) {428      if (!length(x)) return(character())429      paste0(with, x, with)430    }431 432 433    ## Invoke install.packages() in clean R session434    peq <- function(x, y) paste(x, y, sep = "" = "")435    installArgs <- c(436      peq(""pkgs"", surround(packratSrcPath, with = ""'"")),437      peq(""lib"", surround(lib, with = ""'"")),438      peq(""repos"", ""NULL""),439      peq(""type"", surround(""source"", with = ""'""))440    )441 442    fmt <- ""utils::install.packages(%s)""443    installCmd <- sprintf(fmt, paste(installArgs, collapse = "", ""))444 445    ## Write script to file (avoid issues with command line quoting446    ## on R 3.4.3)447    installFile <- tempfile(""packrat-bootstrap"", fileext = "".R"")448    writeLines(installCmd, con = installFile)449    on.exit(unlink(installFile), add = TRUE)450 451    fullCmd <- paste(452      surround(file.path(R.home(""bin""), ""R""), with = ""\""""),453      ""--vanilla"",454      ""--slave"",455      ""-f"",456      surround(installFile, with = ""\"""")457    )458    system(fullCmd)459 460    ## Tag the installed packrat so we know it's managed by packrat461    ## TODO: should this be taking information from the lockfile? this is a bit awkward462    ## because we're taking an un-annotated packrat source tarball and simply assuming it's now463    ## an 'installed from source' version464 465    ## -- InstallAgent -- ##466    installAgent <- ""InstallAgent: packrat 0.5.0""467 468    ## -- InstallSource -- ##469    installSource <- ""InstallSource: source""470 471    packratDescPath <- file.path(lib, ""packrat"", ""DESCRIPTION"")472    DESCRIPTION <- readLines(packratDescPath)473    DESCRIPTION <- c(DESCRIPTION, installAgent, installSource)474    cat(DESCRIPTION, file = packratDescPath, sep = ""\n"")475 476    # Otherwise, continue on as normal477    message(""> Attaching packrat"")478    library(""packrat"", character.only = TRUE, lib.loc = lib)479 480    message(""> Restoring library"")481    if (needsRestore)482      packrat::restore(prompt = FALSE, restart = FALSE)483 484    # If the environment allows us to restart, do so with a call to restore485    restart <- getOption(""restart"")486    if (!is.null(restart)) {487      message(""> Packrat bootstrap successfully completed. "",488              ""Restarting R and entering packrat mode..."")489      return(restart())490    }491 492    # Callers (source-erers) can define this hidden variable to make sure we don't enter packrat mode493    # Primarily useful for testing494    if (!exists("".__DONT_ENTER_PACKRAT_MODE__."") && interactive()) {495      message(""> Packrat bootstrap successfully completed. Entering packrat mode..."")496      packrat::on()497    }498 499    Sys.unsetenv(""RSTUDIO_PACKRAT_BOOTSTRAP"")500 501  }502 503})504","R"
505"Pathogens","pat-s/pathogen-modeling","code/06-reports.R",".R","713","18","reports_plan = drake_plan(506 507  benchmark_diplodia = wflow_publish(knitr_in(""analysis/benchmark-diplodia.Rmd""), view = FALSE),508 509  benchmark_pathogens = wflow_publish(knitr_in(""analysis/benchmark-pathogens.Rmd""), view = FALSE),510 511  prediction_pathogens = wflow_publish(knitr_in(""analysis/prediction-pathogens.Rmd""), view = FALSE),512 513  pathogen_maps_debugging = wflow_publish(knitr_in(""analysis/pathogen-maps-debugging.Rmd""), view = FALSE),514 515  vis_partitions = wflow_publish(knitr_in(""analysis/vis-partitions.Rmd""), view = FALSE),516 517  vis_opt_paths = wflow_publish(knitr_in(""analysis/vis-opt-paths.Rmd""), view = FALSE),518 519  vis_tuning_effects = wflow_publish(knitr_in(""analysis/vis-tuning-effects.Rmd""), view = FALSE)520 521)522","R"
523"Pathogens","pat-s/pathogen-modeling","code/99-packages.R",".R","1993","42","suppressPackageStartupMessages(library(drake))524suppressPackageStartupMessages(library(mlr))525suppressPackageStartupMessages(library(magrittr))526suppressPackageStartupMessages(library(mlrMBO))527suppressPackageStartupMessages(library(purrr))528suppressPackageStartupMessages(library(parallelMap))529suppressPackageStartupMessages(library(sf))530suppressPackageStartupMessages(library(dplyr))531suppressPackageStartupMessages(library(lwgeom))532suppressPackageStartupMessages(library(forcats))533suppressPackageStartupMessages(library(tibble))534suppressPackageStartupMessages(library(rgdal))535suppressPackageStartupMessages(library(viridis))536suppressPackageStartupMessages(library(rasterVis))537suppressPackageStartupMessages(library(lattice))538suppressPackageStartupMessages(library(latticeExtra))539suppressPackageStartupMessages(library(glue))540suppressPackageStartupMessages(library(RSAGA))541suppressPackageStartupMessages(library(stringr))542suppressPackageStartupMessages(library(GSIF))543suppressPackageStartupMessages(library(sp))544suppressPackageStartupMessages(library(R.utils))545suppressPackageStartupMessages(library(curl))546suppressPackageStartupMessages(library(fs))547suppressPackageStartupMessages(library(rgenoud))548suppressPackageStartupMessages(library(stringr))549suppressPackageStartupMessages(library(ggplot2))550suppressPackageStartupMessages(library(ggspatial))551suppressPackageStartupMessages(library(clustermq))552suppressPackageStartupMessages(library(ggsci))553suppressPackageStartupMessages(library(furrr))554suppressPackageStartupMessages(library(future.callr))555suppressPackageStartupMessages(library(ggpubr))556suppressPackageStartupMessages(library(hrbrthemes))557suppressPackageStartupMessages(library(cowplot))558suppressPackageStartupMessages(library(reporttools))559suppressPackageStartupMessages(library(ggrepel))560suppressPackageStartupMessages(library(ggExtra))561suppressPackageStartupMessages(library(kableExtra))562suppressPackageStartupMessages(library(here))563suppressPackageStartupMessages(library(workflowr))564","R"
565"Pathogens","pat-s/pathogen-modeling","code/04-prediction/prediction.R",".R","11567","244","args_pred = tibble(task = rlang::syms(c(""tasks_pred_no_ph"",566                                        ""tasks_pred_no_ph"",567                                        ""tasks_pred_no_ph"",568                                        ""tasks_pred_no_ph"",569                                        ""tasks_pred_no_ph"",570 571                                        ""diplodia_task_dummy_prediction_no_temp"",572                                        ""diplodia_task_dummy_prediction_no_precip"",573                                        ""diplodia_task_dummy_prediction_no_hail"",574                                        ""diplodia_task_dummy_prediction_no_ph"",575                                        ""diplodia_task_dummy_prediction_no_soil"",576                                        ""diplodia_task_dummy_prediction_no_lithology"",577                                        ""diplodia_task_dummy_prediction_no_slope"",578                                        ""diplodia_task_dummy_prediction_no_pisr"",579 580                                        ""diplodia_task_dummy_prediction_no_ph"",581                                        ""fusarium_task_dummy_prediction_no_ph"",582                                        ""armillaria_task_dummy_no_ph"",583                                        ""heterobasidion_task_dummy_no_ph"",584                                        ""tasks_pred_no_ph"")),585                   learner = c(""lrn_rf"",586                               ""lrn_svm"",587                               ""lrn_xgboost"",588                               ""lrn_kknn"",589                               ""lrn_glm"",590 591                               ""lrn_rf"", # debugging tasks592                               ""lrn_rf"", # debugging tasks593                               ""lrn_rf"", # debugging tasks594                               ""lrn_rf"", # debugging tasks595                               ""lrn_rf"", # debugging tasks596                               ""lrn_rf"", # debugging tasks597                               ""lrn_rf"", # debugging tasks598                               ""lrn_rf"", # debugging tasks599 600                               ""lrn_gam_diplodia_pred_no_ph"",601                               ""lrn_gam_fusarium_pred_no_ph"",602                               ""lrn_gam_armillaria_pred_no_ph"",603                               ""lrn_gam_heterobasidion_pred_no_ph"",604                               ""lrn_brt""),605                   resampling = rlang::syms(rep(""spcv_inner_fiveF"", 18)),606                   param_set = rlang::syms(c(""ps_rf"",607                                             ""ps_svm"",608                                             ""ps_xgboost"",609                                             ""ps_kknn"",610                                             ""NULL"",611 612                                             ""ps_rf"", # debugging tasks613                                             ""ps_rf"", # debugging tasks614                                             ""ps_rf"", # debugging tasks615                                             ""ps_rf"", # debugging tasks616                                             ""ps_rf"", # debugging tasks617                                             ""ps_rf"", # debugging tasks618                                             ""ps_rf"", # debugging tasks619                                             ""ps_rf"", # debugging tasks620 621                                             ""ps_gam_diplodia_fusarium_pred"",622                                             ""ps_gam_diplodia_fusarium_pred"",623                                             ""ps_gam_armillaria_heterobasidion"",624                                             ""ps_gam_armillaria_heterobasidion"",625                                             ""ps_brt"")),626                   tune_ctrl = rlang::syms(c(""tune_ctrl_rf_100"",627                                             ""tune_ctrl_svm_100"",628                                             ""tune_ctrl_xgboost_100"",629                                             ""tune_ctrl_kknn_100"",630                                             ""NULL"",631 632                                             ""tune_ctrl_rf_100"", # debugging tasks633                                             ""tune_ctrl_rf_100"", # debugging tasks634                                             ""tune_ctrl_rf_100"", # debugging tasks635                                             ""tune_ctrl_rf_100"", # debugging tasks636                                             ""tune_ctrl_rf_100"", # debugging tasks637                                             ""tune_ctrl_rf_100"", # debugging tasks638                                             ""tune_ctrl_rf_100"", # debugging tasks639                                             ""tune_ctrl_rf_100"", # debugging tasks640 641                                             ""tune_ctrl_gam_100_diplodia_fusarium_pred"",642                                             ""tune_ctrl_gam_100_diplodia_fusarium_pred"",643                                             ""tune_ctrl_gam_100_armillaria_heterobasidion"",644                                             ""tune_ctrl_gam_100_armillaria_heterobasidion"",645                                             ""tune_ctrl_brt_100"")),646                   prediction_data = c(rep(rlang::syms(""pred_data_no_ph""), 5),647 648                                       rlang::syms(""pred_data_no_temp""),649                                       rlang::syms(""pred_data_no_precip""),650                                       rlang::syms(""pred_data_no_hail""),651                                       rlang::syms(""pred_data_no_ph""),652                                       rlang::syms(""pred_data_no_soil""),653                                       rlang::syms(""pred_data_no_lithology""),654                                       rlang::syms(""pred_data_no_slope""),655                                       rlang::syms(""pred_data_no_pisr""),656 657                                       rep(rlang::syms(""pred_data_no_ph""), 5)),658                   prediction_grid = rep(rlang::syms(""temperature_mean""), 18),659                   desc_resampling = c(""spatial/spatial"",660                                       ""spatial/spatial"",661                                       ""spatial/spatial"",662                                       ""spatial/spatial"",663                                       ""spatial/no tuning"",664 665                                       ""spatial/spatial"", # debugging tasks666                                       ""spatial/spatial"", # debugging tasks667                                       ""spatial/spatial"", # debugging tasks668                                       ""spatial/spatial"", # debugging tasks669                                       ""spatial/spatial"", # debugging tasks670                                       ""spatial/spatial"", # debugging tasks671                                       ""spatial/spatial"", # debugging tasks672                                       ""spatial/spatial"", # debugging tasks673 674                                       ""spatial/spatial"",675                                       ""spatial/spatial"",676                                       ""spatial/spatial"",677                                       ""spatial/spatial"",678                                       ""spatial/spatial"")679)680args_pred$id = suppressWarnings(paste0(""prediction_"", str_split(args_pred$learner, ""_"", simplify = TRUE)[, 2]))681args_pred$learner = rlang::syms(args_pred$learner)682 683args_pred[6, ""id""] = ""prediction_debugging_diplodia_no_temp""684args_pred[7, ""id""] = ""prediction_debugging_diplodia_no_precip""685args_pred[8, ""id""] = ""prediction_debugging_diplodia_no_hail""686args_pred[9, ""id""] = ""prediction_debugging_diplodia_no_ph""687args_pred[10, ""id""] = ""prediction_debugging_diplodia_no_soil""688args_pred[11, ""id""] = ""prediction_debugging_diplodia_no_lithology""689args_pred[12, ""id""] = ""prediction_debugging_diplodia_no_slope""690args_pred[13, ""id""] = ""prediction_debugging_diplodia_no_pisr""691 692args_pred[14, ""id""] = ""prediction_gam_diplodia_no_ph""693args_pred[15, ""id""] = ""prediction_gam_fusarium_no_ph""694args_pred[16, ""id""] = ""prediction_gam_armillaria_no_ph""695args_pred[17, ""id""] = ""prediction_gam_heterobasidion_no_ph""696 697prediction_prob_plan = map_plan(args_pred, prediction_custom, trace = FALSE)698 699 700# prediction maps ---------------------------------------------------------701 702args_pred = tibble(prediction_raster = c(""prediction_glm"",703 704                                         ""prediction_gam_diplodia_no_ph"",705                                         ""prediction_gam_fusarium_no_ph"",706                                         ""prediction_gam_armillaria_no_ph"",707                                         ""prediction_gam_heterobasidion_no_ph"",708 709                                         ""prediction_svm"",710 711                                         ""prediction_rf"",712 713                                         ""prediction_kknn"",714 715                                         ""prediction_xgboost"",716 717                                         ""prediction_brt"",718 719                                         ""prediction_debugging_diplodia_no_temp"",720                                         ""prediction_debugging_diplodia_no_precip"",721                                         ""prediction_debugging_diplodia_no_hail"",722                                         ""prediction_debugging_diplodia_no_ph"",723                                         ""prediction_debugging_diplodia_no_soil"",724                                         ""prediction_debugging_diplodia_no_lithology"",725                                         ""prediction_debugging_diplodia_no_slope"",726                                         ""prediction_debugging_diplodia_no_pisr""727),728model_name = c(""glm"",729 730               ""gam"",731               ""gam"",732               ""gam"",733               ""gam"",734 735               ""svm"",736 737               ""rf"",738 739               ""kknn"",740 741               ""xgboost"",742 743               ""brt"",744 745               ""rf"",746               ""rf"",747               ""rf"",748               ""rf"",749               ""rf"",750               ""rf"",751               ""rf"",752               ""rf""753),754benchmark_object = c(""bm_sp_non_glm"",755 756                     ""bm_sp_sp_diplodia_gam"",757                     ""bm_sp_sp_fusarium_gam"",758                     ""bm_sp_sp_armillaria_gam"",759                     ""bm_sp_sp_heterobasidion_gam"",760 761                     ""no_extract_bm_sp_sp_svm"",762                     ""no_extract_bm_sp_sp_rf"",763                     ""no_extract_bm_sp_sp_kknn"",764                     ""no_extract_bm_sp_sp_xgboost"",765                     ""no_extract_bm_sp_sp_brt"",766 767                     ""no_extract_bm_sp_sp_brt"", # debugging768                     ""no_extract_bm_sp_sp_brt"", # debugging769                     ""no_extract_bm_sp_sp_brt"", # debugging770                     ""no_extract_bm_sp_sp_brt"", # debugging771                     ""no_extract_bm_sp_sp_brt"", # debugging772                     ""no_extract_bm_sp_sp_brt"", # debugging773                     ""no_extract_bm_sp_sp_brt"", # debugging774                     ""no_extract_bm_sp_sp_brt"" # debugging775),776resampling = c(# glm777  ""spatial/no tuning"",778 779  # gam780  ""spatial/spatial"",781  ""spatial/spatial"",782  ""spatial/spatial"",783  ""spatial/spatial"",784 785  ""spatial/spatial"",786  ""spatial/spatial"",787  ""spatial/spatial"",788  ""spatial/spatial"",789  ""spatial/spatial"",790 791  ""NA"", # debugging792  ""NA"", # debugging793  ""NA"", # debugging794  ""NA"", # debugging795  ""NA"", # debugging796  ""NA"", # debugging797  ""NA"", # debugging798  ""NA"") # debugging799)800 801args_pred$id = suppressWarnings(paste0(""maps_"", gsub(""prediction_"", """", args_pred$prediction_raster)))802args_pred$prediction_raster = rlang::syms(args_pred$prediction_raster)803args_pred$benchmark_object = rlang::syms(args_pred$benchmark_object)804 805prediction_maps_plan = map_plan(args_pred, create_prediction_map, trace = FALSE)806 807rm(list=ls(pattern=""args_pred""))808","R"
809"Pathogens","pat-s/pathogen-modeling","code/01-data/task.R",".R","8428","170","810# tasks all predictors ----------------------------------------------------811 812heterobasidion_task_dummy <- task_custom(heterobasidion_data,813                                         ""heterobasidion"", ""heterobasi"",814                                         dummy_features = c(""lithology"", ""soil""),815                                         dummy.factors = TRUE816)817 818armillaria_task_dummy <- task_custom(armillaria_data,819                                     ""armillaria"", ""armillaria"",820                                     dummy_features = c(""lithology"", ""soil""),821                                     dummy.factors = TRUE822)823 824diplodia_task_dummy <- task_custom(diplodia_data,825                                   ""diplodia"", ""diplo01"",826                                   dummy_features = c(""lithology"", ""soil"", ""year""),827                                   dummy.factors = TRUE828)829 830diplodia_task <- task_custom(diplodia_data,831                             ""diplodia"", ""diplo01"",832                             dummy_features = c(""lithology"", ""soil"", ""year""),833                             dummy.factors = FALSE834)835 836fusarium_task_dummy <- task_custom(fusarium_data,837                                   ""fusarium"", ""fus01"",838                                   dummy_features = c(""lithology"", ""soil"", ""year""),839                                   dummy.factors = TRUE840)841 842diplodia_task_dummy_prediction <- task_custom_prediction(diplodia_data,843                                                         ""diplodia"", ""diplo01"",844                                                         dummy_features = c(""lithology"", ""soil""),845                                                         dummy.factors = TRUE,846                                                         remove.vars = TRUE847)848 849fusarium_task_dummy_prediction <- task_custom_prediction(fusarium_data,850                                                         ""fusarium"", ""fus01"",851                                                         dummy_features = c(""lithology"", ""soil""),852                                                         dummy.factors = TRUE,853                                                         remove.vars = TRUE854)855 856# tasks no ph -------------------------------------------------------------857 858 859heterobasidion_task_dummy_no_ph <- task_custom(heterobasidion_data_no_ph,860                                               ""heterobasidion"", ""heterobasi"",861                                               dummy_features = c(""lithology"", ""soil""),862                                               dummy.factors = TRUE863)864 865armillaria_task_dummy_no_ph <- task_custom(armillaria_data_no_ph,866                                           ""armillaria"", ""armillaria"",867                                           dummy_features = c(""lithology"", ""soil""),868                                           dummy.factors = TRUE869)870 871diplodia_task_dummy_no_ph <- task_custom(diplodia_data_no_ph,872                                         ""diplodia"", ""diplo01"",873                                         dummy_features = c(""lithology"", ""soil"", ""year""),874                                         dummy.factors = TRUE875)876 877diplodia_task_no_ph <- task_custom(diplodia_data_no_ph,878                                   ""diplodia"", ""diplo01"",879                                   dummy_features = c(""lithology"", ""soil"", ""year""),880                                   dummy.factors = FALSE881)882 883fusarium_task_dummy_no_ph <- task_custom(fusarium_data_no_ph,884                                         ""fusarium"", ""fus01"",885                                         dummy_features = c(""lithology"", ""soil"", ""year""),886                                         dummy.factors = TRUE887)888 889diplodia_task_dummy_prediction_no_ph <- task_custom_prediction(diplodia_data_no_ph,890                                                               ""diplodia"", ""diplo01"",891                                                               dummy_features = c(""lithology"", ""soil""),892                                                               dummy.factors = TRUE,893                                                               remove.vars = TRUE894)895 896fusarium_task_dummy_prediction_no_ph <- task_custom_prediction(fusarium_data_no_ph,897                                                               ""fusarium"", ""fus01"",898                                                               dummy_features = c(""lithology"", ""soil""),899                                                               dummy.factors = TRUE,900                                                               remove.vars = TRUE901)902 903# Debugging tasks ---------------------------------------------------------904 905# We can't put them into a list because each one needs its own prediction task906 907diplodia_task_dummy_prediction_no_temp <- task_custom_prediction(diplodia_data_no_temp,908                                                                 ""diplodia"", ""diplo01"",909                                                                 dummy_features = c(""lithology"", ""soil""),910                                                                 dummy.factors = TRUE,911                                                                 remove.vars = TRUE912)913 914diplodia_task_dummy_prediction_no_precip <- task_custom_prediction(diplodia_data_no_precip,915                                                                   ""diplodia"", ""diplo01"",916                                                                   dummy_features = c(""lithology"", ""soil""),917                                                                   dummy.factors = TRUE,918                                                                   remove.vars = TRUE919)920 921diplodia_task_dummy_prediction_no_hail <- task_custom_prediction(diplodia_data_no_hail,922                                                                 ""diplodia"", ""diplo01"",923                                                                 dummy_features = c(""lithology"", ""soil""),924                                                                 dummy.factors = TRUE,925                                                                 remove.vars = TRUE926)927 928diplodia_task_dummy_prediction_no_soil <- task_custom_prediction(diplodia_data_no_soil,929                                                                 ""diplodia"", ""diplo01"",930                                                                 dummy_features = c(""lithology""),931                                                                 dummy.factors = TRUE,932                                                                 remove.vars = TRUE933)934 935diplodia_task_dummy_prediction_no_lithology <- task_custom_prediction(diplodia_data_no_lithology,936                                                                      ""diplodia"", ""diplo01"",937                                                                      dummy_features = c(""soil""),938                                                                      dummy.factors = TRUE,939                                                                      remove.vars = TRUE940)941 942diplodia_task_dummy_prediction_no_slope <- task_custom_prediction(diplodia_data_no_slope,943                                                                  ""diplodia"", ""diplo01"",944                                                                  dummy_features = c(""lithology"", ""soil""),945                                                                  dummy.factors = TRUE,946                                                                  remove.vars = TRUE947)948 949diplodia_task_dummy_prediction_no_pisr <- task_custom_prediction(diplodia_data_no_pisr,950                                                                 ""diplodia"", ""diplo01"",951                                                                 dummy_features = c(""lithology"", ""soil""),952                                                                 dummy.factors = TRUE,953                                                                 remove.vars = TRUE954)955 956# Combined tasks ---------------------------------------------------------957 958tasks <- list(959  armillaria_task_dummy,960  heterobasidion_task_dummy,961  diplodia_task_dummy,962  fusarium_task_dummy963)964 965tasks_pred <- list(966  armillaria_task_dummy,967  heterobasidion_task_dummy,968  diplodia_task_dummy_prediction,969  fusarium_task_dummy_prediction970)971 972tasks_pred_no_ph <- list(973  armillaria_task_dummy_no_ph,974  heterobasidion_task_dummy_no_ph,975  diplodia_task_dummy_prediction_no_ph,976  fusarium_task_dummy_prediction_no_ph977)978","R"
979"Pathogens","pat-s/pathogen-modeling","code/01-data/data.R",".R","18326","279","# data with ph -----------------------------------------------------------980 981armillaria_data = extract_variables(""https://zenodo.org/record/2621996/files/heterobasidion-armillaria.gpkg"",982                                    study_area = data_basque, drop_vars = ""heterobasi"",983                                    response = ""armillaria"",984                                    soil = soil, lithology = lithology, slope = slope,985                                    temperature = temperature_mean, ph = ph,986                                    hail = hail_raw, precipitation = precipitation_sum,987                                    pisr = pisr, elevation = elevation, age = FALSE)988heterobasidion_data = extract_variables(""https://zenodo.org/record/2621996/files/heterobasidion-armillaria.gpkg"",989                                        study_area = data_basque, drop_vars = ""armillaria"",990                                        response = ""heterobasi"",991                                        soil = soil, lithology = lithology, slope = slope,992                                        temperature = temperature_mean, ph = ph,993                                        hail = hail_raw, precipitation = precipitation_sum,994                                        pisr = pisr, elevation = elevation, age = FALSE)995fusarium_data = extract_variables(""https://zenodo.org/record/2621996/files/diplodia-fusarium.gpkg"",996                                  study_area = data_basque, drop_vars = ""diplo01"",997                                  response = ""fus01"",998                                  soil = soil, lithology = lithology, slope = slope,999                                  temperature = temperature_mean, ph = ph,1000                                  hail = hail_raw, precipitation = precipitation_sum,1001                                  pisr = pisr, elevation = elevation, age = TRUE)1002diplodia_data = extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1003                                  study_area = data_basque, drop_vars = ""fus01"",1004                                  response = ""diplo01"",1005                                  soil = soil, lithology = lithology, slope = slope,1006                                  temperature = temperature_mean, ph = ph,1007                                  hail = hail_raw, precipitation = precipitation_sum,1008                                  pisr = pisr, elevation = elevation, age = TRUE)1009 1010# data without ph ---------------------------------------------------------1011 1012armillaria_data_no_ph = extract_variables(""https://zenodo.org/record/2621996/files/heterobasidion-armillaria.gpkg"",1013                                    study_area = data_basque, drop_vars = ""heterobasi"",1014                                    response = ""armillaria"",1015                                    soil = soil, lithology = lithology, slope = slope,1016                                    temperature = temperature_mean, ph = ph,1017                                    hail = hail_raw, precipitation = precipitation_sum,1018                                    pisr = pisr, elevation = elevation, age = FALSE,1019                                    remove_pred = ""ph"")1020diplodia_data_no_ph = extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1021                                  study_area = data_basque, drop_vars = ""fus01"",1022                                  response = ""diplo01"",1023                                  soil = soil, lithology = lithology, slope = slope,1024                                  temperature = temperature_mean, ph = ph,1025                                  hail = hail_raw, precipitation = precipitation_sum,1026                                  pisr = pisr, elevation = elevation, age = TRUE,1027                                  remove_pred = ""ph"")1028fusarium_data_no_ph = extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1029                                        study_area = data_basque, drop_vars = ""diplo01"",1030                                        response = ""fus01"",1031                                        soil = soil, lithology = lithology, slope = slope,1032                                        temperature = temperature_mean, ph = ph,1033                                        hail = hail_raw, precipitation = precipitation_sum,1034                                        pisr = pisr, elevation = elevation, age = TRUE,1035                                        remove_pred = ""ph"")1036heterobasidion_data_no_ph = extract_variables(""https://zenodo.org/record/2621996/files/heterobasidion-armillaria.gpkg"",1037                                        study_area = data_basque, drop_vars = ""armillaria"",1038                                        response = ""heterobasi"",1039                                        soil = soil, lithology = lithology, slope = slope,1040                                        temperature = temperature_mean, ph = ph,1041                                        hail = hail_raw, precipitation = precipitation_sum,1042                                        pisr = pisr, elevation = elevation, age = FALSE,1043                                        remove_pred = ""ph"")1044 1045 1046# debugging data ----------------------------------------------------------1047 1048 1049# data with extracted temp, precip and pisr1050diplodia_data_no_temp =  extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1051                                           study_area = data_basque, drop_vars = ""fus01"",1052                                           response = ""diplo01"",1053                                           soil = soil, lithology = lithology, slope = slope,1054                                           temperature = temperature_mean, ph = ph,1055                                           hail = hail_raw, precipitation = precipitation_sum,1056                                           pisr = pisr, elevation = elevation, age = TRUE,1057                                           remove_pred = ""temp"")1058 1059# data with extracted temp, precip and pisr1060diplodia_data_no_precip =  extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1061                                           study_area = data_basque, drop_vars = ""fus01"",1062                                           response = ""diplo01"",1063                                           soil = soil, lithology = lithology, slope = slope,1064                                           temperature = temperature_mean, ph = ph,1065                                           hail = hail_raw, precipitation = precipitation_sum,1066                                           pisr = pisr, elevation = elevation, age = TRUE,1067                                           remove_pred = ""precip"")1068 1069# data with extracted temp, precip and pisr1070diplodia_data_no_hail =  extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1071                                           study_area = data_basque, drop_vars = ""fus01"",1072                                           response = ""diplo01"",1073                                           soil = soil, lithology = lithology, slope = slope,1074                                           temperature = temperature_mean, ph = ph,1075                                           hail = hail_raw, precipitation = precipitation_sum,1076                                           pisr = pisr, elevation = elevation, age = TRUE,1077                                           remove_pred = ""hail_probability"")1078 1079# data with extracted temp, precip and pisr1080diplodia_data_no_soil =  extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1081                                           study_area = data_basque, drop_vars = ""fus01"",1082                                           response = ""diplo01"",1083                                           soil = soil, lithology = lithology, slope = slope,1084                                           temperature = temperature_mean, ph = ph,1085                                           hail = hail_raw, precipitation = precipitation_sum,1086                                           pisr = pisr, elevation = elevation, age = TRUE,1087                                           remove_pred = ""soil"")1088 1089# data with extracted temp, precip and pisr1090diplodia_data_no_lithology =  extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1091                                           study_area = data_basque, drop_vars = ""fus01"",1092                                           response = ""diplo01"",1093                                           soil = soil, lithology = lithology, slope = slope,1094                                           temperature = temperature_mean, ph = ph,1095                                           hail = hail_raw, precipitation = precipitation_sum,1096                                           pisr = pisr, elevation = elevation, age = TRUE,1097                                           remove_pred = ""lithology"")1098 1099# data with extracted temp, precip and pisr1100diplodia_data_no_slope =  extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1101                                           study_area = data_basque, drop_vars = ""fus01"",1102                                           response = ""diplo01"",1103                                           soil = soil, lithology = lithology, slope = slope,1104                                           temperature = temperature_mean, ph = ph,1105                                           hail = hail_raw, precipitation = precipitation_sum,1106                                           pisr = pisr, elevation = elevation, age = TRUE,1107                                           remove_pred = ""slope_degrees"")1108 1109# data with extracted temp, precip and pisr1110diplodia_data_no_pisr =  extract_variables(""https://zenodo.org/record/2621996//files/diplodia-fusarium.gpkg"",1111                                           study_area = data_basque, drop_vars = ""fus01"",1112                                           response = ""diplo01"",1113                                           soil = soil, lithology = lithology, slope = slope,1114                                           temperature = temperature_mean, ph = ph,1115                                           hail = hail_raw, precipitation = precipitation_sum,1116                                           pisr = pisr, elevation = elevation, age = TRUE,1117                                           remove_pred = ""pisr"")1118 1119# Raw Data preprocessing ------------------------------------------------------------1120 1121data_basque = st_read(""https://zenodo.org/record/2621996/files/study-area.gpkg"",1122                      quiet = TRUE)1123 1124dem_raw = dem_download(""https://zenodo.org/record/2621996/files/dem.zip"")1125slope = slope_processing(data = dem_raw)1126elevation = elevation_preprocessing(data = dem_raw)1127 1128temperature_mean = temperature_preprocessing(atlas_climatico = atlas_climatico)1129precipitation_sum = precipitation_preprocessing(atlas_climatico = atlas_climatico)1130pisr = pisr_preprocessing(atlas_climatico = atlas_climatico)1131 1132lithology_raw = lithology_download(url = ""https://zenodo.org/record/2621996/files/lithology.zip"")1133lithology = lithology_preprocessing(lithology_raw)1134 1135soil_raw = soil_download(""https://zenodo.org/record/2621996/files/soil.tif"")1136soil = soil_preprocessing(data = soil_raw,1137                          study_area = data_basque)1138 1139# we cannot make ph public unfortunately so we load it locally from the repo1140ph = ph_preprocessing(data = ""data/ph/"", study_area = data_basque)1141 1142atlas_climatico_raw = atlas_climatico_download(""https://zenodo.org/record/2621996/files/atlas-climatico.zip"")1143atlas_climatico = atlas_climatico_preprocessing(data = atlas_climatico_raw,1144                                                study_area = data_basque)1145 1146hail_raw = hail_download(url = ""https://zenodo.org/record/2621996/files/hail-probability.tif"")1147 1148# Prediction data ---------------------------------------------------------1149 1150pred_data = create_prediction_data(temperature = temperature_mean,1151                                   precipitation = precipitation_sum,1152                                   pisr = pisr,1153                                   elevation = elevation,1154                                   soil = soil,1155                                   slope = slope,1156                                   lithology = lithology,1157                                   hail = hail_raw,1158                                   ph = ph,1159                                   dummy_features = c(""lithology"", ""soil"")1160                                   )1161 1162pred_data_no_temp = create_prediction_data(temperature = temperature_mean,1163                                           precipitation = precipitation_sum,1164                                           pisr = pisr,1165                                           elevation = elevation,1166                                           soil = soil,1167                                           slope = slope,1168                                           lithology = lithology,1169                                           hail = hail_raw,1170                                           ph = ph,1171                                           dummy_features = c(""lithology"", ""soil""),1172                                           drop_var = ""temp"")1173 1174pred_data_no_precip = create_prediction_data(temperature = temperature_mean,1175                                             precipitation = precipitation_sum,1176                                             pisr = pisr,1177                                             elevation = elevation,1178                                             soil = soil,1179                                             slope = slope,1180                                             lithology = lithology,1181                                             hail = hail_raw,1182                                             ph = ph,1183                                             dummy_features = c(""lithology"", ""soil""),1184                                             drop_var = ""precip"")1185 1186pred_data_no_soil = create_prediction_data(temperature = temperature_mean,1187                                           precipitation = precipitation_sum,1188                                           pisr = pisr,1189                                           elevation = elevation,1190                                           soil = soil,1191                                           slope = slope,1192                                           lithology = lithology,1193                                           hail = hail_raw,1194                                           ph = ph,1195                                           dummy_features = c(""lithology""),1196                                           drop_var = ""soil"")1197 1198pred_data_no_ph = create_prediction_data(temperature = temperature_mean,1199                                         precipitation = precipitation_sum,1200                                         pisr = pisr,

Showing the first 1,200 of 71921 lines. Download the file for the rest.