Skip to content

Commit

Permalink
Merge branch 'v0.97'
Browse files Browse the repository at this point in the history
  • Loading branch information
ZekeMarshall committed Mar 5, 2024
2 parents 472049e + 18cf540 commit df61cbe
Show file tree
Hide file tree
Showing 38 changed files with 626 additions and 586 deletions.
4 changes: 2 additions & 2 deletions R/create_constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ resultsViewNVCAssign_options <- c(#"Site, Jaccard" = "nvcAssignSiteJaccard",
#"Group, Jaccard" = "nvcAssignGroupJaccard",
"Site, Czekanowski" = "nvcAssignSiteCzekanowski",
"Group, Czekanowski" = "nvcAssignGroupCzekanowski",
"Quadrat, Jaccard" = "nvcAssignQuadratJaccard"#,
"Quadrat, Jaccard" = "nvcAssignPlotJaccard"#,
# "Quadrat, Czekanowski" = "nvcAssignQuadratCzekanowski"
)

Expand Down Expand Up @@ -227,6 +227,6 @@ reportOptions_options <- list(#`NVC Assignment Pseudo-quadrat` = c("Site" = "nvc
`MVA` = c("National" = "mvaNationalReference",
"Local (restricted)" = "mvaLocalReferenceRestricted",
"Local (unrestricted)" = "mvaLocalReferenceUnrestricted"),
`Survey Table` = c("Survey Table" = "surveyTable")
`Survey Table` = c("Survey Table" = "surveyData")
)

10 changes: 5 additions & 5 deletions R/functions.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Base R or tidyverse?

# Convert surveyTable to surveyTableWide
# Convert surveyData to surveyDataWide

# Calculate DCA using surveyTableWide and selected nvc_pquad_dca_list DCA results
# Calculate DCA using surveyDataWide and selected nvc_pquad_dca_list DCA results

# Produce a DCA plot ggplot2 graph with points only

# Produce a DCA plot ggplot2 graph with points and convex hulls

# Produce a DCA plot ggplot2 graph with sample quadrat points and convex hulls

# Calculate diversity metrics using surveyTable
# Calculate diversity metrics using surveyData

# Calculate mean cover-weighted EIVs using surveyTable
# Calculate mean cover-weighted EIVs using surveyData

# Calculate mean EIVs using surveyTable
# Calculate mean EIVs using surveyData


1 change: 1 addition & 0 deletions R/load_packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ library(shinyjs)
library(shinybusy)

# General
library(R6)
library(rmarkdown)
library(bookdown)
library(tidyverse)
Expand Down
9 changes: 0 additions & 9 deletions R/similarity_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ similarityCzekanowski <- function(samp_df, comp_df,
samp_weight_name, comp_weight_name,
downweight_threshold = 0.2, downweight_value = 0.1){

assign(x = "samp_df", value = samp_df, envir = .GlobalEnv)
assign(x = "comp_df", value = comp_df, envir = .GlobalEnv)
assign(x = "samp_species_col", value = samp_species_col, envir = .GlobalEnv)
assign(x = "comp_species_col", value = comp_species_col, envir = .GlobalEnv)
assign(x = "samp_group_name", value = samp_group_name, envir = .GlobalEnv)
assign(x = "comp_group_name", value = comp_group_name, envir = .GlobalEnv)
assign(x = "samp_weight_name", value = samp_weight_name, envir = .GlobalEnv)
assign(x = "comp_weight_name", value = comp_weight_name, envir = .GlobalEnv)

# Check argument types are correct
checkmate::assertDataFrame(samp_df)
checkmate::assertDataFrame(comp_df)
Expand Down
6 changes: 3 additions & 3 deletions R/syntopicTable_functions.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Compose floristic tables from surveyTable
composeSyntopicTables <- function(surveyTable, group_cols, species_col_name = "Species", plot_col_name = "Quadrat"){
# Compose floristic tables from surveyData
composeSyntopicTables <- function(surveyData, group_cols, species_col_name = "Species", plot_col_name = "Quadrat"){

syntopicTables <- surveyTable |>
syntopicTables <- surveyData |>
tidyr::unite(col = "ID", group_cols, sep = " - ", remove = TRUE) |>
dplyr::select(ID, plot_col_name, species_col_name) |>
dplyr::mutate("Present" = 1) |>
Expand Down
9 changes: 5 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,28 @@ knitr::opts_chunk$set(
# RMAVIS

<!-- badges: start -->
[![Generic badge](https://img.shields.io/badge/Version-0.96-green.svg)]()
[![Generic badge](https://img.shields.io/badge/Version-0.97-green.svg)]()
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
<!-- badges: end -->

The RMAVIS R shiny web application is a tool to assist in the assignment of vegetation plot
sample data to UK National Vegetation Classification units, with additional exploratory analysis.
sample data to UK National Vegetation Classification units, with additional exploratory analyses.

## Running the app

You can run RMAVIS from [GitHub](https://github.com/ZekeMarshall/RMAVIS) by cloning the
repository, calling `renv::restore()`, and then calling `shiny::runApp("app.R")`.

If `renv::restore()` fails run `install.packages(unique(renv::dependencies()$Package), dependencies = TRUE)`.
If `renv::restore()` fails run `install.packages(unique(renv::dependencies()$Package), dependencies = TRUE)`.
Note that whilst the correct dependencies will be installed, the versions may not match those in the renv.lock file.

Future developments may support the release of RMAVIS as an R package.

## Hosting

### Posit Connect

RMAVIS is currently hosted on the UKCEH Posit Connect server:
RMAVIS is currently hosted on the UKCEH Posit Connect server: https://connect-apps.ceh.ac.uk/RMAVIS/

### Docker

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<!-- badges: start -->

[![Generic
badge](https://img.shields.io/badge/Version-0.96-green.svg)]()
badge](https://img.shields.io/badge/Version-0.97-green.svg)]()
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
<!-- badges: end -->

The RMAVIS R shiny web application is a tool to assist in the assignment
of vegetation plot sample data to UK National Vegetation Classification
units, with additional exploratory analysis.
units, with additional exploratory analyses.

## Running the app

Expand All @@ -22,6 +22,8 @@ by cloning the repository, calling `renv::restore()`, and then calling

If `renv::restore()` fails run
`install.packages(unique(renv::dependencies()$Package), dependencies = TRUE)`.
Note that whilst the correct dependencies will be installed, the
versions may not match those in the renv.lock file.

Future developments may support the release of RMAVIS as an R package.

Expand All @@ -30,6 +32,7 @@ Future developments may support the release of RMAVIS as an R package.
### Posit Connect

RMAVIS is currently hosted on the UKCEH Posit Connect server:
<https://connect-apps.ceh.ac.uk/RMAVIS/>

### Docker

Expand Down
22 changes: 10 additions & 12 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ source("R/load_data.R", local = TRUE)
source("R/create_constants.R", local = TRUE)

# Render documentation ----------------------------------------------------
source("R/render_docs.R", local = TRUE) # This can be disabled if one wishes to pre-render the documentation manually.
# This can be disabled if one wishes to pre-render the documentation manually.
source("R/render_docs.R", local = TRUE)

# Source functions --------------------------------------------------------
source("R/syntopicTable_functions.R", local = TRUE)
Expand All @@ -34,17 +35,17 @@ source("modules/setupData_server.R", local = TRUE)
source("modules/uploadData_ui.R", local = TRUE)
source("modules/uploadData_server.R", local = TRUE)

source("modules/surveyTable_ui.R", local = TRUE)
source("modules/surveyTable_server.R", local = TRUE)
source("modules/surveyData_ui.R", local = TRUE)
source("modules/surveyData_server.R", local = TRUE)

source("modules/surveyTableValidator_ui.R", local = TRUE)
source("modules/surveyTableValidator_server.R", local = TRUE)
source("modules/surveyDataValidator_ui.R", local = TRUE)
source("modules/surveyDataValidator_server.R", local = TRUE)

source("modules/surveyTableSummary_ui.R", local = TRUE)
source("modules/surveyTableSummary_server.R", local = TRUE)
source("modules/surveyDataSummary_ui.R", local = TRUE)
source("modules/surveyDataSummary_server.R", local = TRUE)

source("modules/surveyTableWide_ui.R", local = TRUE)
source("modules/surveyTableWide_server.R", local = TRUE)
source("modules/floristicTables_ui.R", local = TRUE)
source("modules/floristicTables_server.R", local = TRUE)

# source("modules/selectedPquads_server.R", local = TRUE)

Expand All @@ -54,9 +55,6 @@ source("modules/nvcAssignment_server.R", local = TRUE)
source("modules/habCor_ui.R", local = TRUE)
source("modules/habCor_server.R", local = TRUE)

source("modules/floristicTables_ui.R", local = TRUE)
source("modules/floristicTables_server.R", local = TRUE)

source("modules/speciesFreq_ui.R", local = TRUE)
source("modules/speciesFreq_server.R", local = TRUE)

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
build:
context: .
dockerfile: Dockerfile
image: "<container registry url>/rmavis:v0.96"
image: "<container registry url>/rmavis:v0.97"
container_name: "rmavis"
restart: always
privileged: true
Expand Down
33 changes: 29 additions & 4 deletions docs/documentation.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "RMAVIS - Documentation"
subtitle: "v0.96"
subtitle: "v0.97"
# output:
# bookdown::word_document2:
# always_allow_html: true
Expand Down Expand Up @@ -81,7 +81,7 @@ reportOptions_options <- list(`NVC Assignment` = c("Site, Czekanowski" = "nvcAss
`MVA` = c("National" = "mvaNationalReference",
"Local (restricted)" = "mvaLocalReferenceRestricted",
"Local (unrestricted)" = "mvaLocalReferenceUnrestricted"),
`Survey Table` = c("Survey Table" = "surveyTable")
`Survey Table` = c("Survey Table" = "surveyData")
)
```
Expand Down Expand Up @@ -530,6 +530,16 @@ to be displayed in the MVA plots:
Here the user may select any NVC community to display in the **National
Reference** MVA plot only.

**Group Survey Plots**

Three options are available to 'group' the survey quadrat/plot data:

- No, the individual plots are left ungrouped.
- Group, mean DCA axis scores are calculated from the individual plots
by group.
- Year, mean DCA axis scores are calculated from the individual plots
by year.

**Survey Quadrat Selection**

Three methods are available for subsetting the survey quadrats being
Expand Down Expand Up @@ -566,6 +576,7 @@ plots.
- Survey Quadrats, the survey quadrats entered in **Survey Data**.
- Pseudo-Quadrats, all pseudo-quadrats used in the DCA ordination.
- Reference Space, the convex hulls formed around the pseudo-quadrats.
- Reference Centroids, the centroids formed from the pseudo-quadrat DCA scores.
- Species, the species DCA axis scores.
- Unique Survey Species, the species present in the survey quadrats
but absent in the top-fitted NVC communities pseudo-quadrats.
Expand Down Expand Up @@ -638,7 +649,7 @@ Marshall, Z., Smart, S., and Harrower, C.. (2024). RMAVIS.
@misc{marshall2024,
author = {Marshall, Z. and Smart, S. and Harrower, C.},
title = {RMAVIS},
howpublished = {Available at https://connect-apps.ceh.ac.uk/RMAVIS/, version 0.96},
howpublished = {Available at https://connect-apps.ceh.ac.uk/RMAVIS/, version 0.97},
month = {02},
year = {2024},
note = {A R Shiny application for the assignment of vegetation survey data to National Vegetation Classification (NVC) communities, with additional exploratory analyses.}
Expand All @@ -649,6 +660,20 @@ Marshall, Z., Smart, S., and Harrower, C.. (2024). RMAVIS.

<details>

<summary>v0.97</summary>

<strong>2024/03/XX</strong>

- Modifications: NA
- Fixes:
- Updating documentation to reflect new MVA functionality.
- Fixing group survey plots option in MVA module.
- New Features: NA

</details>

<details>

<summary>v0.96</summary>

<strong>2024/03/02</strong>
Expand Down Expand Up @@ -678,7 +703,7 @@ Marshall, Z., Smart, S., and Harrower, C.. (2024). RMAVIS.
- Making survey data availability table searchable.
- Changing nomenclature for releve to plot.
- Fixes:
- Ensuring report renders correctly using new surveyTableSummary
- Ensuring report renders correctly using new surveyDataSummary
object data.
- New Features: NA

Expand Down
2 changes: 1 addition & 1 deletion docs/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ <h1><span class="header-section-number">5</span> Release Log</h1>
</ul></li>
<li>Fixes:
<ul>
<li>Ensuring report renders correctly using new surveyTableSummary object data.</li>
<li>Ensuring report renders correctly using new surveyDataSummary object data.</li>
</ul></li>
<li>New Features: NA</li>
</ul>
Expand Down
11 changes: 6 additions & 5 deletions modules/calcAvgEIVs_server.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
calcAvgEIVs <- function(input, output, session, surveyTable, sidebar_options) {
calcAvgEIVs <- function(input, output, session, surveyData, sidebar_options) {

ns <- session$ns

Expand Down Expand Up @@ -268,7 +268,7 @@ calcAvgEIVs <- function(input, output, session, surveyTable, sidebar_options) {

observe({

shiny::req(surveyTable())
shiny::req(surveyData())

shinybusy::show_modal_spinner(
spin = "fading-circle",
Expand All @@ -279,13 +279,14 @@ calcAvgEIVs <- function(input, output, session, surveyTable, sidebar_options) {
# Isolate reactive objects
shiny::isolate({

surveyTable <- surveyTable()
surveyData <- surveyData()
surveyData_long <- surveyData$surveyData_long


# Calculate Weighted Mean HE Values ---------------------------------------

# By Quadrat
weightedMeanHEValuesQuadrat <- surveyTable |>
weightedMeanHEValuesQuadrat <- surveyData_long |>
dplyr::rename("species" = "Species") |>
dplyr::left_join(master_data, by = "species",
relationship = "many-to-many") |>
Expand Down Expand Up @@ -340,7 +341,7 @@ calcAvgEIVs <- function(input, output, session, surveyTable, sidebar_options) {
# Calculate Unweighted Mean HE Values -------------------------------------

# By Quadrat
unweightedMeanHEValuesQuadrat <- surveyTable |>
unweightedMeanHEValuesQuadrat <- surveyData_long |>
dplyr::rename("species" = "Species") |>
dplyr::left_join(master_data, by = "species",
relationship = "many-to-many") |>
Expand Down
Loading

0 comments on commit df61cbe

Please sign in to comment.