This function compares for each plot (and other provided variables) the differences between periods/years for the column names given in parameter measure_vars. It gives results for differences between subsequent measures (based on 'period') and between the last and the first measure. All column names of the dataset that are not added to parameter measure_vars, are considered as grouping variables, except for period. If the result is not as expected, please verify that the dataset only consists of grouping variables, variables added to measure_vars and period.

compare_periods_per_plot(dataset, measure_vars)

Arguments

dataset

dataframe with values for each period, plot and year, in addition to grouping variables and measure_vars

measure_vars

column names of variables that should be compared between periods (including year)

Value

dataframe with columns plot, year_diff, n_years, grouping variables and differences between periods for each column of measure_vars

Examples

if (FALSE) {
#change path before running
library(forrescalc)
library(dplyr)
treenr_by_plot <-
  read_forresdat(tablename = "dendro_by_plot", repo_path = "C:/gitrepo/forresdat") %>%
  select(period, year, plot_id, number_of_tree_species, number_of_trees_ha) %>%
  distinct()
compare_periods_per_plot(treenr_by_plot, c("year", "number_of_tree_species", "number_of_trees_ha"))
}