Skip to content

Commit ea75821

Browse files
authored
Update data_to_natural.R
1 parent 21da616 commit ea75821

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎R/data_to_natural.R‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' @param data the input data in R-Abimo format
1616
#' @param type a character object containing the name of natural scenario.
1717
#' Defaults to "undeveloped"
18-
#' @param veg_class vegetation class to assign to each row in \code{data}.
18+
#' @param veg_class vegetation class to assign to each row in \code{data} if current value is lower.
1919
#' Default: 50
2020
#' @return a dataframe with R-Abimo input data for the chosen natural scenario
2121
#' @export
@@ -37,8 +37,8 @@ data_to_natural <- function(data, type = "undeveloped", veg_class = 50)
3737
data[urban_columns] <- 0
3838

3939
# set vegetation class
40-
data["veg_class"] <- veg_class
41-
40+
data[["veg_class"]] <- pmax(data[["veg_class"]], veg_class, na.rm = TRUE)
41+
4242
if (type != "undeveloped") {
4343
land_types <- select_columns(data, "land_type")
4444
is_waterbody <- land_type_is_waterbody(land_types)

0 commit comments

Comments
 (0)