icraf-indonesia / LUMENSR

An R package for land use planning and management of multiple environmental services.
https://icraf-indonesia.github.io/LUMENSR/
Other
0 stars 0 forks source link

Integrate Pre-QUES into LUMENSR #1

Open dindiarto opened 1 year ago

dindiarto commented 1 year ago

Description:

The goal of this issue is to develop key functions for visualizing and analyzing land use change based on the following development basis: https://github.com/mariaadeliaw/lumens_updates/blob/main/PRE-QUES-MANUAL-multiyears.R

Tasks:

Acceptance Criteria:

dindiarto commented 1 year ago

In developing LUMENS-R, we should adopt a slightly different approach compared to the current PRE-QUES analysis. Instead of writing a single, lengthy R script, we need to break it down into smaller, functional, and testable functions. This "divide and conquer" strategy will make our code more modular and maintainable.

@mariaadeliaw and team, to ensure best practices in writing functions, please follow the guidelines provided in the devtools package manual. This includes proper documentation and testing for each function we create. By adhering to these principles, we can build a more robust and efficient LUMENS-R implementation.

dindiarto commented 1 year ago

create_crosstab

I have developed a custom function that extends the functionality of the crosstab function to calculate land use change tables. The function takes a raster list as input, creates a stack, and then applies the crosstab function to generate a frequency table. It further filters out rows where the frequency is not equal to zero. This additional functionality provides more comprehensive land use change analysis. See 068c27f

dindiarto commented 1 year ago

create_sankey

The create_sankey function takes a frequency table (crosstab) as input, filters it to include only rows with frequencies greater than the average, and generates a Sankey diagram based on the filtered table. Users can customize various aspects of the diagram, such as the maximum number of categories, font size, positioning, labeling options, and color. The function utilizes the flipPlots package to create the Sankey diagram. See 068c27f