| Title: | Analyse Soil Tillage Depth and Erosion Over Time |
|---|---|
| Description: | Provides tools to record, validate, and analyse soil tillage depth and erosion across years and field treatments. Includes functions for year-wise tillage operation summaries, erosion depth tracking, compaction detection, soil loss estimation, and visualisation of temporal changes in tillage and erosion profiles. Methods follow Lal (2001) <doi:10.1201/9780203739280> and Renard et al. (1997) "Predicting Soil Erosion by Water: A Guide to Conservation Planning with the Revised Universal Soil Loss Equation (RUSLE)" <https://ntrl.ntis.gov/NTRL/dashboard/searchResults/titleDetail/PB97153704.xhtml>. |
| Authors: | Sadikul Islam [aut, cre] (ORCID: <https://orcid.org/0000-0003-2924-7122>) |
| Maintainer: | Sadikul Islam <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-22 08:28:13 UTC |
| Source: | https://github.com/cran/soiltillr |
Provides tools to record, validate, and analyse soil tillage depth and erosion across years and field treatments. Includes functions for year-wise tillage operation summaries, erosion depth tracking, compaction detection, soil loss estimation, and visualisation of temporal changes in tillage and erosion profiles.
validate_soil_dataChecks a data frame for missing columns, negative values, empty rows, and implausible year values before any analysis.
summarise_tillageYear x field summary: n_operations, mean/max/total depth, dominant operation type.
tillage_depth_trendYear-on-year change in mean tillage depth per field; classifies each
year as "baseline", "increasing", "decreasing",
or "stable".
detect_compactionCompaction risk ("high", "moderate", "low") and
estimated plow pan depth from tillage records.
track_erosion_depthAnnual erosion depth, year-on-year change, cumulative loss, and trend direction per field.
estimate_soil_lossMass-balance soil loss estimate (t/ha) using erosion depth, bulk density, and an optional McCool LS slope correction.
compare_fieldsWide-format year-by-year comparison of erosion depth and organic matter between two or more fields.
plot_tillage_timelineLine plot of mean annual tillage depth by field.
plot_erosion_trendLine plot of annual erosion depth; optional cumulative panel.
plot_om_trendSoil organic matter (\
plot_tillage_erosionDual-panel figure comparing tillage depth and erosion depth.
tillage_operations20-row hypothetical tillage records for Field_A and Field_B (2018–2023).
erosion_profile12-row hypothetical annual erosion and soil health measurements for the same fields.
Sadikul Islam [email protected] (ORCID: 0000-0003-2924-7122)
Lal, R. (2001). Soil degradation by erosion. Land Degradation and Development, 12(6), 519–539. doi:10.1002/ldr.472
McCool, D. K., Brown, L. C., Foster, G. R., Mutchler, C. K., & Meyer, L. D. (1987). Revised slope steepness factor for the Universal Soil Loss Equation. Transactions of the ASAE, 30(5), 1387–1396. doi:10.13031/2013.30576
Renard, K. G., Foster, G. R., Weesies, G. A., McCool, D. K., & Yoder, D. C. (1997). Predicting Soil Erosion by Water: A Guide to Conservation Planning with the Revised Universal Soil Loss Equation (RUSLE). USDA Agriculture Handbook No. 703. https://ntrl.ntis.gov/NTRL/dashboard/searchResults/titleDetail/PB97153704.xhtml
Produces a year-by-year side-by-side comparison of erosion depth and organic matter content between two or more fields, showing absolute differences and relative change.
compare_fields(data, year_col, field_col, erosion_col, om_col)compare_fields(data, year_col, field_col, erosion_col, om_col)
data |
A data frame containing annual erosion and soil measurements. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
erosion_col |
Character string. Name of the erosion depth column (mm). |
om_col |
Character string. Name of the organic matter column (percent). |
A data frame with one row per year containing erosion and organic matter values for each field as separate columns, plus difference columns.
data(erosion_profile) comparison <- compare_fields(erosion_profile, "year", "field_id", "erosion_depth_mm", "organic_matter_pct") print(comparison)data(erosion_profile) comparison <- compare_fields(erosion_profile, "year", "field_id", "erosion_depth_mm", "organic_matter_pct") print(comparison)
Identifies years where tillage practices are likely to cause or worsen soil compaction based on tillage depth, frequency, and operation type. Deep primary tillage (moldboard plowing) followed by shallow secondary tillage creates a compaction layer (plow pan) just below tillage depth.
detect_compaction( data, year_col, field_col, depth_col, op_col = NULL, compaction_threshold_cm = 20 )detect_compaction( data, year_col, field_col, depth_col, op_col = NULL, compaction_threshold_cm = 20 )
data |
A data frame containing tillage operation records. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
depth_col |
Character string. Name of the tillage depth column (cm). |
op_col |
Optional character string. Name of the operation type column. |
compaction_threshold_cm |
Numeric. Depth threshold (cm) above which tillage is considered to risk creating a plow pan (default: 20). |
A data frame with columns:
year |
Year. |
field_id |
Field identifier. |
mean_depth_cm |
Mean tillage depth (cm). |
compaction_risk |
Risk level: |
plow_pan_depth_cm |
Estimated plow pan depth (cm): just below mean tillage depth. |
data(tillage_operations) risk <- detect_compaction(tillage_operations, "year", "field_id", "depth_cm", op_col = "operation") print(risk)data(tillage_operations) risk <- detect_compaction(tillage_operations, "year", "field_id", "depth_cm", op_col = "operation") print(risk)
Hypothetical annual soil erosion measurements for two agricultural fields (Field_A and Field_B) over six years (2018–2023), including erosion depth, soil loss, bulk density, organic matter, rainfall, and slope.
data(erosion_profile)data(erosion_profile)
A data frame with 12 rows and 8 columns:
integer. Calendar year of measurement.
character. Field identifier: "Field_A" or "Field_B".
numeric. Annual soil erosion depth in millimetres.
numeric. Annual soil loss in tonnes per hectare.
numeric. Topsoil bulk density in g/cm.
numeric. Topsoil organic matter content as percentage by weight.
numeric. Annual rainfall in millimetres.
numeric. Field slope as percentage. Fixed at 4.5% for Field_A and 2.8% for Field_B.
Field_A shows declining erosion depth and soil loss as tillage management shifts from conventional to conservation practices over the study period. Bulk density initially increases due to deep plowing compaction, then decreases as conservation tillage improves soil structure. Organic matter follows an inverse pattern, declining under intensive tillage and recovering under conservation management.
Field_B maintains consistently lower erosion and higher organic matter throughout, demonstrating the long-term benefit of reduced tillage.
This dataset is designed for use with track_erosion_depth(),
detect_compaction(), estimate_soil_loss(), and
plot_erosion_trend().
Hypothetical data generated for package illustration purposes.
Lal, R. (2001). Soil degradation by erosion. Land Degradation and Development, 12(6), 519–539. doi:10.1002/ldr.472
data(erosion_profile) # View structure str(erosion_profile) # Track erosion depth over years result <- track_erosion_depth(erosion_profile, "year", "field_id", "erosion_depth_mm") print(result)data(erosion_profile) # View structure str(erosion_profile) # Track erosion depth over years result <- track_erosion_depth(erosion_profile, "year", "field_id", "erosion_depth_mm") print(result)
Estimates annual soil loss in tonnes per hectare using a simplified
approach based on erosion depth, bulk density, and field slope.
If soil_loss_col is already present in the data, it is returned
directly with a comparison to the estimated value.
estimate_soil_loss( data, year_col, field_col, erosion_col, bulk_density_col, slope_col = NULL )estimate_soil_loss( data, year_col, field_col, erosion_col, bulk_density_col, slope_col = NULL )
data |
A data frame containing annual erosion and soil measurements. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
erosion_col |
Character string. Name of erosion depth column (mm). |
bulk_density_col |
Character string. Name of bulk density column
(g/cm |
slope_col |
Optional character string. Name of slope column (percent). Used as a weighting factor. |
Soil loss is estimated as:
where 10000 converts from m/m to t/ha assuming
bulk density in g/cm equals t/m.
A slope correction factor of is applied when
slope data are available.
A data frame with columns:
Year.
Field identifier.
Measured erosion depth (mm).
Estimated soil loss (t/ha).
Category: "tolerable" (< 5 t/ha/yr),
"moderate" (5–10), "severe" (10–20),
or "very severe" (> 20).
data(erosion_profile) loss <- estimate_soil_loss(erosion_profile, "year", "field_id", "erosion_depth_mm", "bulk_density_g_cm3", slope_col = "slope_pct") print(loss)data(erosion_profile) loss <- estimate_soil_loss(erosion_profile, "year", "field_id", "erosion_depth_mm", "bulk_density_g_cm3", slope_col = "slope_pct") print(loss)
Creates a line plot of annual erosion depth over time for each field, with an optional panel showing cumulative erosion loss.
plot_erosion_trend( data, year_col, field_col, erosion_col, show_cumulative = FALSE, title = NULL )plot_erosion_trend( data, year_col, field_col, erosion_col, show_cumulative = FALSE, title = NULL )
data |
A data frame containing annual erosion measurements. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
erosion_col |
Character string. Name of the erosion depth column (mm). |
show_cumulative |
Logical. Whether to add a second panel showing
cumulative erosion (default: |
title |
Optional character string. Plot title. |
A ggplot2 object.
data(erosion_profile) plot_erosion_trend(erosion_profile, "year", "field_id", "erosion_depth_mm")data(erosion_profile) plot_erosion_trend(erosion_profile, "year", "field_id", "erosion_depth_mm")
Creates a line plot showing organic matter content (percent) over years for each field, illustrating the effect of tillage management on soil health.
plot_om_trend(data, year_col, field_col, om_col, title = NULL)plot_om_trend(data, year_col, field_col, om_col, title = NULL)
data |
A data frame containing annual soil measurements. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
om_col |
Character string. Name of the organic matter column (percent). |
title |
Optional character string. Plot title. |
A ggplot2 object.
data(erosion_profile) plot_om_trend(erosion_profile, "year", "field_id", "organic_matter_pct")data(erosion_profile) plot_om_trend(erosion_profile, "year", "field_id", "organic_matter_pct")
Creates a dual-panel plot showing mean tillage depth alongside erosion depth for each field over time, making the relationship between tillage management and erosion outcomes visually clear.
plot_tillage_erosion( tillage_data, erosion_data, year_col, field_col, depth_col, erosion_col, title = NULL )plot_tillage_erosion( tillage_data, erosion_data, year_col, field_col, depth_col, erosion_col, title = NULL )
tillage_data |
A data frame containing tillage operation records. |
erosion_data |
A data frame containing annual erosion measurements. |
year_col |
Character string. Name of the year column (must exist in both data frames). |
field_col |
Character string. Name of the field identifier column (must exist in both data frames). |
depth_col |
Character string. Name of tillage depth column in
|
erosion_col |
Character string. Name of erosion depth column in
|
title |
Optional character string. Plot title. |
A ggplot2 object with two facet panels.
data(tillage_operations) data(erosion_profile) plot_tillage_erosion(tillage_operations, erosion_profile, "year", "field_id", "depth_cm", "erosion_depth_mm")data(tillage_operations) data(erosion_profile) plot_tillage_erosion(tillage_operations, erosion_profile, "year", "field_id", "depth_cm", "erosion_depth_mm")
Creates a line plot showing mean annual tillage depth over time for each field, making it easy to identify shifts toward conservation tillage.
plot_tillage_timeline( data, year_col, field_col, depth_col, op_col = NULL, title = NULL )plot_tillage_timeline( data, year_col, field_col, depth_col, op_col = NULL, title = NULL )
data |
A data frame containing tillage operation records. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
depth_col |
Character string. Name of the tillage depth column (cm). |
op_col |
Optional character string. Name of the operation type column. |
title |
Optional character string. Plot title. |
A ggplot2 object.
data(tillage_operations) plot_tillage_timeline(tillage_operations, "year", "field_id", "depth_cm")data(tillage_operations) plot_tillage_timeline(tillage_operations, "year", "field_id", "depth_cm")
Computes year-wise summary statistics of tillage depth and operation frequency for each field, including mean depth, maximum depth, total operations, and dominant operation type.
summarise_tillage( data, year_col, field_col, depth_col, op_col = NULL, validate = TRUE )summarise_tillage( data, year_col, field_col, depth_col, op_col = NULL, validate = TRUE )
data |
A data frame containing tillage operation records. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
depth_col |
Character string. Name of the tillage depth column (cm). |
op_col |
Optional character string. Name of the operation type column. If provided, the dominant operation per year-field is included in output. |
validate |
Logical. Whether to validate inputs before analysis
(default: |
A data frame with one row per year-field combination containing:
year |
Year of tillage operations. |
field_id |
Field identifier. |
n_operations |
Number of tillage operations performed. |
mean_depth_cm |
Mean tillage depth (cm). |
max_depth_cm |
Maximum tillage depth (cm). |
total_depth_cm |
Cumulative tillage depth (cm). |
dominant_operation |
Most frequent operation type (if op_col provided). |
data(tillage_operations) result <- summarise_tillage(tillage_operations, "year", "field_id", "depth_cm", op_col = "operation") print(result)data(tillage_operations) result <- summarise_tillage(tillage_operations, "year", "field_id", "depth_cm", op_col = "operation") print(result)
Computes the annual mean tillage depth per field and calculates the year-on-year change, helping identify whether tillage intensity is increasing, decreasing, or stable over time.
tillage_depth_trend(data, year_col, field_col, depth_col, validate = TRUE)tillage_depth_trend(data, year_col, field_col, depth_col, validate = TRUE)
data |
A data frame containing tillage operation records. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
depth_col |
Character string. Name of the tillage depth column (cm). |
validate |
Logical. Whether to validate inputs (default: |
A data frame with columns:
year |
Year. |
field_id |
Field identifier. |
mean_depth_cm |
Mean tillage depth for that year (cm). |
depth_change_cm |
Change in mean depth from previous year (cm).
|
trend |
Direction of change: |
data(tillage_operations) trend <- tillage_depth_trend(tillage_operations, "year", "field_id", "depth_cm") print(trend)data(tillage_operations) trend <- tillage_depth_trend(tillage_operations, "year", "field_id", "depth_cm") print(trend)
Hypothetical year-wise tillage operation records for two agricultural fields (Field_A and Field_B) over six years (2018–2023). Field_A transitions from conventional deep tillage to conservation tillage, while Field_B follows a reduced tillage practice throughout.
tillage_operationstillage_operations
A data frame with 20 rows and 6 columns:
integer. Calendar year of the tillage operation.
Date. Exact date of the tillage operation.
character. Field identifier: "Field_A" or
"Field_B".
character. Type of tillage operation. One of
"moldboard_plow", "chisel_plow", "disc_harrow",
"conservation_till", or "no_till".
numeric. Tillage depth in centimetres. Zero for no-till operations.
numeric. Implement operating speed in km/hr.
NA for no-till operations.
Field_A represents a field under conventional management that gradually adopts conservation practices: starting with moldboard plowing at 30+ cm depth and transitioning to conservation tillage and no-till by 2022–2023. Field_B maintains reduced tillage (chisel plow and no-till) throughout the study period, serving as a comparison treatment.
This dataset is intended for use with summarise_tillage(),
tillage_depth_trend(), and plot_tillage_timeline().
Hypothetical data generated for package illustration purposes.
data(tillage_operations) # View structure str(tillage_operations) # Summarise by year and field result <- summarise_tillage(tillage_operations, "year", "field_id", "depth_cm") print(result)data(tillage_operations) # View structure str(tillage_operations) # Summarise by year and field result <- summarise_tillage(tillage_operations, "year", "field_id", "depth_cm") print(result)
Computes year-on-year change in erosion depth for each field and calculates cumulative erosion since the first recorded year.
track_erosion_depth(data, year_col, field_col, erosion_col, validate = TRUE)track_erosion_depth(data, year_col, field_col, erosion_col, validate = TRUE)
data |
A data frame containing annual erosion measurements. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
erosion_col |
Character string. Name of the erosion depth column (mm). |
validate |
Logical. Whether to validate inputs (default: |
A data frame with columns:
Year.
Field identifier.
Annual erosion depth (mm).
Year-on-year change in erosion depth (mm).
NA for the first year of each field.
Cumulative erosion depth since first year (mm).
Direction: "improving", "worsening",
"stable", or "baseline".
data(erosion_profile) result <- track_erosion_depth(erosion_profile, "year", "field_id", "erosion_depth_mm") print(result)data(erosion_profile) result <- track_erosion_depth(erosion_profile, "year", "field_id", "erosion_depth_mm") print(result)
Checks a data frame for common issues before passing it to analysis functions: missing columns, missing values, negative depths, and non-positive years.
validate_soil_data(data, year_col, field_col, value_col)validate_soil_data(data, year_col, field_col, value_col)
data |
A data frame containing tillage or erosion data. |
year_col |
Character string. Name of the year column. |
field_col |
Character string. Name of the field identifier column. |
value_col |
Character string. Name of the numeric measurement column (depth, soil loss, etc.). |
A list with components:
valid |
Logical. |
issues |
Character vector of critical issues found. |
warnings |
Character vector of non-critical warnings. |
data(tillage_operations) result <- validate_soil_data(tillage_operations, "year", "field_id", "depth_cm") print(result$valid) print(result$warnings)data(tillage_operations) result <- validate_soil_data(tillage_operations, "year", "field_id", "depth_cm") print(result$valid) print(result$warnings)