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

Update readme #9

Closed dindiarto closed 1 year ago

dindiarto commented 1 year ago

Proposed Additions

Current Development Stage: An overview of what the current development stage offers. This will help potential users understand the package's capabilities and status.

Running the Analysis: Detailed steps on how to run the analysis. This should include:

  1. Installing the package and its dependencies: Provide specific commands or instructions for installing the package and any required dependencies.
  2. Downloading the qmd file: Detail the steps or command to download the necessary qmd file for the analysis.
  3. Rendering the qmd file: Outline the steps or commands needed to successfully render the qmd file.
dindiarto commented 1 year ago

LUMENSR is a tool under experimental development, currently offering the Pre-QuES module. This module facilitates the analysis of land use changes by comparing land cover maps from two distinct time periods. The comparison provides valuable insights into how land use in a specific region has transformed over time.

To get started see:

Installation:

As LUMENSR is currently under experimental development, install the latest development version from GitHub using the following commands:

install.packages("devtools")
devtools::install_github("icraf-indonesia/LUMENSR")

After installation, load the package with:

library(LUMENSR)

Once installed, you can use this package in the R console, within quarto documents and within Shiny applications. You may need to download the quarto CLI.

Contributing

We appreciate your feedback and contributions. Please report any problems encountered while using LUMENSR as “issues” on our GitHub repository. Your input will help us improve this package!

A minimal working example

Here's a simple example of how to use LUMENSR:

# Load the LUMENSR package
library(LUMENSR)

# Load the example raster files and convert them into a terra::rast object
# Add a legend to the raster using a lookup table
NTT_LC90 <- LUMENSR_example("NTT_LC90.tif")
NTT_LC90_rast <- terra::rast(NTT_LC90)
NTT_LC90_legend <- add_legend_to_categorical_raster(raster_file = NTT_LC90_rast, lookup_table = lc_lookup_klhk_sequence)

NTT_LC20 <- LUMENSR_example("NTT_LC20.tif")
NTT_LC20_rast <- terra::rast(NTT_LC20)
NTT_LC20_legend <- add_legend_to_categorical_raster(raster_file = NTT_LC20_rast, lookup_table = lc_lookup_klhk_sequence)

# Create a frequency table from the list of raster files
raster_list <- list(NTT_LC90_legend, NTT_LC20_legend)
crosstab_result <- create_crosstab(raster_list)
crosstab_result_abbreviated <- abbreviate_by_column(crosstab_result, c("NTT_LC90", "NTT_LC20"), remove_vowels = FALSE)

# Create a Sankey diagram from the frequency table
create_sankey(crosstab_result_abbreviated, area_cutoff = 10000, change_only = FALSE)

image

Interested in preparing and producing a Pre-QUES report?

Navigate to the following link for a well-commented example Quarto script. Download the qmd files and render them using:

quarto::quarto_render("Pre-QUES.qmd")
dindiarto commented 1 year ago

done