Learn R Programming

{width="150"}

SoilManageR

Introduction

This R package is a compilation of functions to calculate numerical agricultural soil management indicators from on a management timeline of an arable field. The functions can also be used independently of the management timeline to calculate some indicators or parts thereof. Througout the package, many assumptions were made (e.g. on time to crop establishment). These assumptions are, whenever possible, based on the literature that is cited within the function descriptions. The assumptions are considered to be representative for temperate agroecosystems, i.e. in the Swiss midlands.

{width="700"}

SoilManageR organizes management data in management data frames management_df(), from this the indicators can then be calculated. For the calculations there are main functions and helper functions that are called by the main functions (Fig. 1). Both type of functions rely on reference data for their calculations. The package is distributed with some supporting documents.

Installation

You can install the current release version of SoilManageR from CRAN with:

install.packages("SoilManageR")

or you can install the development version of SoilManageR from GitLab with:

install.packages("devtools")
devtools::install_gitlab("SoilManageR/SoilManageR")

Suggested Workflow

Load and check management data frame

We suggest to start the workflow with importing a management_df() from a XLSX template.

library(SoilManageR)

#define path to excel template in the SoilManageR package
internal_path <- "/extdata/SoilManageR_mgmt_data_template_V2.5.xlsx"

#create local path
path_to_xlsx_template <- system.file(internal_path, package = "SoilManageR")

#load management_df
mgmt_data <- management_df_from_excel(path_to_xlsx_template)

Then the management_df() can be checked for internal consistency with the check_management_df() function.

#create management_df from example data (delivered with the package)
mgmt_data <- EXAMPLE_data

#check the consistency of the example data
check_management_df(mgmt_data)

Calculate indicators

When the management_df() shows no issues, then all indicators can be calcualted with calculate_indicators()

calculate_indicators(mgmt_data)

Alternatively, the indicators could be calculated individually

C_input(mgmt_data)
tillage_intensity(mgmt_data)
soil_cover(mgmt_data)
plant_diversity(mgmt_data,2013,2023)

Access helper functions

All helper functions can be called directly, please check the description of the functions for more information on them.

About the Package

Acknowledgments

This R package was developed by following the book R Packages (2nd Edition) by Hadley Wickham and Jennifer Bryan. Our work is based on the accomplishments of many others. In particular, we would like to thank Sonja Keel (Agroscope, Switzerland), Martin Bolinder (SLU, Sweden), Giulio Feruzzi (USDA-NRCS, USA), Lucie Büchi (University of Greenwich, United Kingdom) for their advice and support.

Contact

For further information on SoilManageR please contact olivier.heller@agroscope.admin.ch or raphael.wittwer@agroscope.admin.ch.

Funding information

The development of this R package was supported by EJP SOIL.

{width="300"}

{width="200"}

Copy Link

Version

Install

install.packages('SoilManageR')

Monthly Downloads

522

Version

1.0.1

License

MIT + file LICENSE

Maintainer

Olivier Heller

Last Published

October 1st, 2024

Functions in SoilManageR (1.0.1)

management_df_from_excel

Import management_df from excel file
SoilManageR-package

SoilManageR: Calculate Soil Management Indicators for Agricultural Practice Assessment
%>%

Pipe operator
plant_diversity

Calculate plant diversity indicators
relative_yield

Calculate relative yield
calculate_indicators

Calculate all soil management indicators
tillage_intensity

Estimate tillage intensity
soil_cover

Estimate soil cover by plants and residues
check_management_df

Check management_df for consitency
productivity_indicator

Calculate average productivity
plot_management_df

Plot a management dataframe
shannon_index

Calculate Shannon Index for diversity
plot.soil_cover_tibble

Plotting soil_cover_tibbles
CN_input_amendments

Estimate C and N inputs of organic amendments
C_input_crops_LUT

Look-up-table with default values to calculate carbon (C) inputs by crops
C_input_cover_crops

Estimate C inputs by cover crops
C_input_crops

Estimate C inputs by crops
C_input

Estimate carbon input
STIR

Calculate STIR value
N_input

Estimate nitrogen input
management_df

Constructor for management_df
filter_management_df

Filter management_df for pattern in comments
arrange_management_df

arrange management_df by date, category
plant_cover

Estimate soil cover percentage by plants
CN_input_amendments_LUT

Look-up-table with default values to calculate C and N inputs by organic amendments
EXAMPLE_data

Example of a management_df
plant_cover_LUT

Look-up-table with default values to estimate soil cover by plants
STIR_values_LUT

Look-up-table with default values for tillage operations