Skip to content

Commit

Permalink
Added find_connections into the main function
Browse files Browse the repository at this point in the history
  • Loading branch information
derek-corcoran-barrios committed Apr 19, 2023
1 parent 13c9406 commit 9925798
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
18 changes: 18 additions & 0 deletions R/Troublemaker.R
Expand Up @@ -11,6 +11,15 @@
#' @param budget maximum cost for the problem
#' @param Rastercurrentlanduse raster object of current landuses
#' @param name The name of the output file
#' @param directions just as in \code{\link{adjacent}} character or
#' matrix to indicated the directions in which cells are considered
#' connected.
#' The following character values are allowed: "rook" or "4" for the
#' horizontal and vertical neighbors; "bishop" to get the diagonal
#' neighbors; "queen" or "8" to get the vertical, horizontal and
#' diagonal neighbors; or "16" for knight and one-cell queen move
#' neighbors. If directions is a matrix it should have odd dimensions
#' and have logical (or 0, 1) values
#' @param verbose Logical whether messages will be written while the
#' function is generating calculations, defaults to FALSE
#' @return A .dat file with the spatial problem formated for AMPL. This function is used for the side-effect of writing values to a file.
Expand Down Expand Up @@ -81,6 +90,7 @@
troublemaker <- function(Rasterdomain = NULL, Rastercurrent = NULL, species_names = NULL, Rasterspecieslanduse = NULL, landuses = NULL,
budget = NULL,
Rastercurrentlanduse = NULL,
directions = NULL,
name = "Problem",
verbose = FALSE){
if(!is.null(Rasterdomain)){
Expand All @@ -89,6 +99,14 @@ troublemaker <- function(Rasterdomain = NULL, Rastercurrent = NULL, species_name
message("TempDomain ready")
}
}
if(!is.null(Rasterdomain) & !is.null(directions)){
TroublemakeR::find_connections(Rasterdomain = Rasterdomain,
name = name,
directions = directions)
if(verbose){
message("connections ready")
}
}
if(!is.null(species_names)){
TroublemakeR::species_names(species_names = species_names, name = name)
}
Expand Down
3 changes: 2 additions & 1 deletion man/find_connections.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions man/troublemaker.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9925798

Please sign in to comment.