Create input and output paths
init_path.Rd
`init_path()` creates paths that will be used to find input data and save outputs.
Usage
init_path(input, output = tempdir(), default = TRUE, classification = NULL)
Arguments
- input
named character vector indicating where to find inputs. This vector defines the path where to look for files in priority. If nothing is specified, paths will be set to `system.file("extdata", "default", package = "floodam.agri")`.
- output
character, path for output. Default to `tempdir()`.
- default
logical, should "default" path be created. If TRUE, "default" path will be set to `system.file("extdata", "default", package = "floodam.agri")`. Default to TRUE.
- classification
character giving the path to the folder which contains classification references. If NULL, no path is created. Default to NULL.
Details
`input` parameter: The order of each element in `input` is important as it will define the order in which inputs will be searched in `path[["extent"]]`.
Examples
path = init_path()
# Unnamed input vector
input = c(
system.file(
"extdata",
"example",
"local",
"winery",
package = "floodam.agri"
),
system.file(
"extdata",
"regional",
"Occitanie",
"2016",
package = "floodam.agri"
),
system.file("extdata", "national", package = "floodam.agri")
)
path = init_path(input)
print(path[["extent"]])
#> [1] "user_01" "user_02" "default"
path = init_path(input, default = FALSE)
print(path[["extent"]])
#> [1] "user_01" "user_02"
names(input) = c("local", "regional", "national")
path = init_path(input)
print(path[["extent"]])
#> [1] "local" "regional" "default"