naturalis/trait-geo-diverse-ungulates

Checks:

Closed this issue · 0 comments

rvosa commented
  • de volgorde van de namen van de layers (die in een vector stonden) klopte niet in relatie tot de volgorde waarin de lagen als TIF bestanden werden ingelezen. Vermoedelijk is het dus zo dat alle variable importance plots daardoor niet klopten.
    files.names <- list.files(paste(REPO_HOME, "/data/GIS/5_deg", sep = ""))
    # Turn the file names into layer names: strip the prefix, which might include
    # the resolution, and strip the file extension
    gis.layers.names <- files.names
    gis.layers.names <- gsub('current_5arcmin_','',gis.layers.names)
    gis.layers.names <- gsub('.tif','',gis.layers.names)
    # Combine the layer names with those we've already read from BIOCLIM
    gis.layers.names <- c(names(gis.layers),gis.layers.names)
    # Iterate over files
    for (i in 1:length(files.names)) {
    # Stack with previously read layers
    gis.layers <- stack(
    gis.layers,
    # Read as raster
    raster(
    # Construct file name
    paste(REPO_HOME, "/data/GIS/5_deg/", files.names[i], sep = "")
    )
    )
    }
    # Apply all names
    names(gis.layers) <- gis.layers.names
  • klopt dit verhaal? Wat doen we hiermee?
    Afterwards the occurrence dataset is split in k-fold partitions: a training
    dataset containing 75% of the data and a test dataset containing 25% of the
    data. The maxent model is constructed using the maxent function from the dismo
    R package (Hijmans & Elith, 2013). The function extracts abiotic environmental
    data for the training occurrence locations and 1000 random sampled background
    locations, resulting in a model maxent object that can be used to predict which
    other locations are suitable.
  • dit moet anders. Als bepaalde soorten niet werken dan moeten ze structureel uit de lijst met taxa want op deze manier gaan we geheid ergens fouten maken met de volgorde
    for (i in c(1:134, 136:150, 152:154)) {
  • Vicagna vicugna klopt niet: de geslachtsnaam is incorrect en deze typefout heeft zich inmiddels door de rest van de bestanden en resultaten heen verspreid
  • de syntax moet netter: we zouden middels styler (of anderszins) de code laten inspringen, dus niet zoals dit blok:
    # combine two lists of valid and invalid models
    output_AUC_valid <- data.frame(matrix(ncol = 3, nrow = length(list_species_model_high_accuracy)))
    colnames(output_AUC_valid) <- c("taxon","trainingAUC","validation")
    AUC.csv <- paste(REPO_HOME, "/results/maxent/AUCvalues.csv", sep="")
    for (i in 1:length(list_species_model_high_accuracy)) {
    open_species_model <- list_species_model_high_accuracy[[i]]
    name <- names(list_species_model_high_accuracy[i])
    name_underscore<- gsub( "_", " ", name)
    trainingAUC<-open_species_model@results[[5,1]]
    output_AUC_valid[i,] <- c(name_underscore, trainingAUC, "valid")
    }
    output_AUC_invalid <- data.frame(matrix(ncol = 3, nrow = length(list_species_model_low_accuracy)))
    colnames(output_AUC_invalid) <- c("taxon","trainingAUC","validation")
    for (i in 1:length(list_species_model_low_accuracy)) {
    open_species_model <- list_species_model_low_accuracy[[i]]
    name <- names(list_species_model_low_accuracy[i])
    name_underscore<- gsub( "_", " ", name)
    trainingAUC<-open_species_model@results[[5,1]]
    output_AUC_invalid[i,] <- c(name_underscore, trainingAUC, "invalid")
    }
    combined_auc<- rbind(output_AUC_invalid, output_AUC_valid)
    write.csv(combined_auc, file= AUC.csv)