Skip to content

Commit

Permalink
lacking function for CIRCLE on landscape level
Browse files Browse the repository at this point in the history
  • Loading branch information
TomekMatuszek committed May 19, 2024
1 parent 8770252 commit c3e2193
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export(vm_c_te)
export(vm_l_area_mn)
export(vm_l_cai_mn)
export(vm_l_circ_mn)
export(vm_l_circle_mn)
export(vm_l_coh_mn)
export(vm_l_comp_mn)
export(vm_l_convex_mn)
Expand Down
27 changes: 27 additions & 0 deletions R/vm_l_circle_mn.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#' @title The mean value of Ratios between the patch area
#' and the smallest circumscribing circle of patches at class level(vector data)
#'
#' @description This function allows you to calculate the mean value of ratios of each class in a categorical landscape in vector data format
#' the ratio is the patch area relative to area of the smallest circumscribing circle of the patch
#' @param landscape the input landscape image,
#' @param class_col the name of the class column of the input landscape
#' @return the returned calculated mean value of ratios of each class is in column "value",
#' and this function returns also some important information such as level, class number and metric name.
#' Moreover, the "id" column, although it is just NA here at class level. we need it because the output struture of metrics
#' at class level should correspond to patch level one by one, and then it is more convinient to combine metric values at different levels and compare them.
#' @examples
#' vm_l_circle_mn(vector_landscape, "class")
#' @export

vm_l_circle_mn <- function(landscape){
circle <- vm_p_circle(landscape)
circle_l <- mean(circle$value)

tibble::new_tibble(list(
level = "landscape",
class = as.character(NA),
id = as.character(NA),
metric = "circle_mn",
value = as.double(circle_l)
))
}
2 changes: 1 addition & 1 deletion man/vectormetrics-package.Rd

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

27 changes: 27 additions & 0 deletions man/vm_l_circle_mn.Rd

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

0 comments on commit c3e2193

Please sign in to comment.