Learn R Programming

SHARK4R (version 1.0.2)

load_shark4r_fields: Load SHARK4R fields from GitHub

Description

This function downloads and sources the SHARK4R required and recommended field definitions directly from the SHARK4R-statistics GitHub repository.

Usage

load_shark4r_fields(verbose = TRUE)

Value

Invisibly returns a list with two elements:

required_fields

Object containing required SHARK fields.

recommended_fields

Object containing recommended SHARK fields.

Arguments

verbose

Logical; if TRUE (default), prints progress messages during download and loading.

Details

The definitions are stored in an R script (fields.R) located in the fields/ folder of the repository. The function sources this file directly from GitHub into the current R session.

The sourced script defines two main objects:

  • required_fields — vector or data frame of required SHARK fields.

  • recommended_fields — vector or data frame of recommended SHARK fields.

The output of this function can be directly supplied to the check_fields function through its field_definitions argument for validating SHARK4R data consistency.

If sourcing fails (e.g., due to a network issue or repository changes), the function throws an error with a descriptive message.

See Also

check_fields for validating datasets using the loaded field definitions (as field_definitions). load_shark4r_stats for loading precomputed SHARK4R statistics,

Examples

Run this code
# \donttest{
# Load SHARK4R field definitions from GitHub
fields <- load_shark4r_fields(verbose = FALSE)

# Access required or recommended fields for the first entry
fields[[1]]$required
fields[[1]]$recommended
# }
if (FALSE) {
# Use the loaded definitions in check_fields()
check_fields(my_data, field_definitions = fields)
}

Run the code above in your browser using DataLab