Package {rapsimng.decide.core}


Title: Decision-Oriented Analysis Core for APSIM Next Generation Outputs
Version: 0.1.2
Description: Provides a low-level interface for analysing Agricultural Production Systems sIMulator ('APSIM') Next Generation simulation outputs to support structured decision-making workflows.
License: MIT + file LICENSE
Encoding: UTF-8
Depends: R (≥ 4.1.0)
Imports: dplyr, rapsimng, tibble, rlang
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
URL: https://core.decide.rapsimng.bangyou.me/, https://github.com/byzheng/rapsimng.decide.core
BugReports: https://github.com/byzheng/rapsimng.decide.core/issues
Config/roxygen2/version: 8.1.1
NeedsCompilation: no
Packaged: 2026-11-21 01:48:27 UTC; zhe00a
Author: Bangyou Zheng [aut, cre]
Maintainer: Bangyou Zheng <zheng.bangyou@gmail.com>
Repository: CRAN
Date/Publication: 2026-11-21 04:10:02 UTC

Build output lines for a decision report document

Description

Converts a rapsimng_decide_document object into a character vector that can be written to disk. A document prefix is written first when present, then each non-NULL section body separated by blank lines.

Usage

document_lines(document)

Arguments

document

A report object with class rapsimng_decide_document.

Value

A character vector containing the ordered document lines.


Read APSIMX output

Description

Read APSIMX output

Usage

read_output(apsimx_file, report = "HarvestReport", years = NULL)

Arguments

apsimx_file

The path to the APSIMX output file (.apsimx)

report

The name of the report to read from the APSIMX output ( default: "HarvestReport")

years

Optional numeric vector of years to filter the output by (e.g., 1996:2025)

Value

A data frame containing the APSIMX output data

Examples

apsimx_file <- system.file(
  "example", "cultivar.apsimx",
  package = "rapsimng.decide.core"
)
output <- read_output(apsimx_file, years = 2010:2011)
head(output)

Write a decision report document to disk

Description

Serialises a rapsimng_decide_document with document_lines() and writes the resulting text file to path.

Usage

write_document(document, path, overwrite = FALSE)

Arguments

document

A report object with class rapsimng_decide_document.

path

A single output file path.

overwrite

Logical scalar indicating whether an existing file may be replaced.

Value

Invisibly returns path.