You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currenly .sum_gfw() is defined as follows in R/calc_treecover_area.R:
.sum_gfw<-function(data, what="coverage_area") {
# calculate loss area by yeardf<-data.frame(years=2000:2022, var=0)
names(df)[2] <-whatmy_sum<- by(data[[what]], data[["lossyear"]], sum, na.rm=TRUE)
sum_years<- as.numeric(names(my_sum))
sum_years<-sum_years+2000index<- match(sum_years, df[["years"]])
df[[what]][index] <- as.numeric(my_sum)
df
}
The line df <- data.frame(years = 2000:2022, var = 0) implies that 2000:2022 must be updated at each get_gfw_lossyear() to include the latest available year for the resource. This is not very intuitive and possibly error prone. I wonder if it would not be convenient to extract the year range directly from the gfw_lossyear resource being used.
The text was updated successfully, but these errors were encountered:
Currenly
.sum_gfw()
is defined as follows inR/calc_treecover_area.R
:The line
df <- data.frame(years = 2000:2022, var = 0)
implies that2000:2022
must be updated at eachget_gfw_lossyear()
to include the latest available year for the resource. This is not very intuitive and possibly error prone. I wonder if it would not be convenient to extract the year range directly from the gfw_lossyear resource being used.The text was updated successfully, but these errors were encountered: