An Interface Between the 'FSKX' Standard and 'R'
Overview
Functions for importing, creating, editing and exporting 'FSK' files https://foodrisklabs.bfr.bund.de/fskx-food-safety-knowledge-exchange-format/ using the 'R' programming environment. Furthermore, it enables users to run simulations contained in the 'FSK' files and visualize the results.
Major New Features
- **Dynamic Script Detection**:
import_fsk()now dynamically detects model and visualization script filenames from metadata.rdf instead of hardcoding "model.r" and "visualization.r". This enables support for FSKX files with non-standard script names. - **Complete Temporary Folder Execution**:
run_simulation()now executes models in their unpacked temporary directory, solving file loading issues for models that depend on CSV, Excel, and other data files (e.g., QMRA models). - **Workspace Copying Functionality**: Added optional workspace copying with intelligent directory naming:
- New parameters:
copy_workspaceandworkspace_modeinrun_simulation()andrun_all_simulations() - Creates directories named:
fsk_workspace_[model_name]_[simulation_name]/ - Three copy modes: "all" (complete workspace), "generated" (new files only), "modified" (changed files only)
- **Model Chaining Support**: Added
inject_to_globalparameter enabling seamless model chaining workflows: - New parameter:
inject_to_globalinrun_simulation()andrun_all_simulations() - When TRUE, simulation variables are injected directly into the user's global environment
- Enables users to access simulation results directly without complex variable extraction
- Facilitates model chaining: use results from Model A as inputs to Model B
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
- Maintains backward compatibility (FALSE by default)
Bug Fixes and Improvements
- Cross-platform line endings: All textual files exported into FSKX archives now use LF line endings on every OS (including Windows). This applies to:
- README.txt, metaData.json, packages.json, manifest.xml, metadata.rdf
- model and visualization scripts
- workspace.r
- sim.sedml and model.sbml
- Other files: R scripts included via
other_filesare normalized to LF on export; other file types are copied unchanged. - Encoding: All textual exports are written as UTF-8 (no BOM).
- Internal: Introduced
write_text_lf()helper to normalize line endings and write via binary connections; XML writers now use binary connections; zipping uses utils::zip to preserve directory structure. - **File Loading Fix**: Models that load external files (CSV, Excel, etc.) now work correctly by executing in the proper temporary directory with automatic working directory restoration.
- **Enhanced Return Values**:
run_simulation()now returns all user-created variables with preserved data types (scalars, vectors, data frames, lists, matrices) . - **Improved Visualization Handling**: Enhanced automatic display of ggplot objects created by visualization scripts.
- **Package Build Optimization**: Added comprehensive
.Rbuildignorefile to exclude development files (test projects, debug scripts, session artifacts) from package builds. - **Robust Error Handling**: Added proper error handling and cleanup for working directory management and workspace copying operations.
- **Updated Documentation**: Enhanced function documentation to reflect new parameters and capabilities.
Breaking Changes
- None - all changes are backward compatible with existing workflows.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-03-10
Documentation
- Help pages
- 61
- Examples that run
- 0%12 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 32%
- Documented parameters
- 100%
- Return-value docs
- 74%
- Help pages citing references
- 0%
Downloads
Dependencies
Installing FSK2R adds 75 packages (47 with compiled code, 61 MB of source tarballs). Heaviest: stringi 11 MB, data.table 5.7 MB, bslib 5.6 MB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 0.2.0Latest2025-10-10 · current release · diff ↗ ·
added 21 exports
FSKAuthor, FSKCreator, FSKDataBackground, FSKGeneralInformation, FSKMetadata, FSKModelCategory, FSKModelMath, FSKParameter, FSKReference, FSKScope, clean_empty_values, read_R_model, read_fsk_json_metadata, read_fsk_manifest, read_fsk_model, read_fsk_packages, read_fsk_rdf_metadata, read_fsk_readme, read_fsk_sim, read_other_files, read_visualization - RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- RR 4.3.0 released · 2023-04-21
- RR 4.2.0 released · 2022-04-22
- 0.1.3
- RR 4.1.0 released · 2021-05-18
- 0.1.22020-10-06 · diff ↗
- 0.1.12020-05-13
- RR 4.0.0 released · 2020-04-24
Package metadata
- First published
- 2020-05-13
- Total releases
- 4 / 6 yrs
- License
- GPL-3 OSI
- Download size
- 1.2 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("FSK2R")The package provides a citation file, so citation() returns the authors' own entry.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.