#' HW_statistics
#' @param area in the unit of 1000 km^2
#' @export
HW_statistics <- function(id, arr, dates, area) {
arr_lgl = array_3dTo2d(arr == id)
nums = colSums2(arr_lgl, na.rm = TRUE)
ind = which(nums != 0)
areas = colSums2(arr_lgl[, ind, drop = FALSE] * area, na.rm = TRUE)
date_begin = dates[ind[1]]
date_end = dates[ind[length(ind)]]
ans <- data.table(
date = seq(date_begin, date_end, by = "day"),
num = nums[ind],
area = areas)
ans
}
# 如果考虑面积加权
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.