Title: Machine-Readable Data Analysis Results with Function Wrappers
Version: 1.0.0
Description: You can use the set of wrappers for analytical schemata to reduce the effort in writing machine-readable data. The set of all-in-one wrappers will cover widely used functions from data analysis packages.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.3
URL: https://gitlab.com/TIBHannover/lki/knowledge-loom/mrap-r
BugReports: https://gitlab.com/TIBHannover/lki/knowledge-loom/mrap-r/-/issues
Imports: dtreg, jsonlite, stringr
Suggests: knitr, lme4, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-11-20 17:43:48 UTC; LezhninaO
Author: Olga Lezhnina ORCID iD [aut, cre], Manuel Prinz ORCID iD [aut], Markus Stocker ORCID iD [aut], Open Research Knowledge Graph Project and Contributors [cph]
Maintainer: Olga Lezhnina <olga.lezhnina@tib.eu>
Repository: CRAN
Date/Publication: 2025-11-25 07:00:08 UTC

mrap: Machine-Readable Data Analysis Results with Function Wrappers

Description

You can use the set of wrappers for analytical schemata to reduce the effort in writing machine-readable data. The set of all-in-one wrappers will cover widely used functions from data analysis packages.

Author(s)

Maintainer: Olga Lezhnina olga.lezhnina@tib.eu (ORCID)

Authors:

Other contributors:

See Also

Useful links:


Create an algorithm_evaluation instance

Description

Create an algorithm_evaluation instance

Usage

algorithm_evaluation(code_string, input_data, named_list_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

named_list_results

A named list with metrics and values

Value

An algorithm_evaluation instance

Examples

res <- list(F1= 0.46, recall = 0.51)
inst_ae <- algorithm_evaluation("N/A", "data_url", res)

Create a class_discovery instance

Description

Create a class_discovery instance

Usage

class_discovery(code_string, input_data, test_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

test_results

A data frame or a list of data frames

Value

A class_discovery instance

Examples

clust_data <- iris[-5]
res <- data.frame(result_1 = 1, result_2 = 2)
inst_cd <- class_discovery(
"stats::kmeans(clust_data, 3)",
iris,
res
)

Create a class_prediction instance

Description

Create a class_prediction instance

Usage

class_prediction(code_string, input_data, test_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

test_results

A data frame or a list of data frames

Value

A class_prediction instance

Examples

res <- data.frame(result_1 = 1, result_2 = 2)
inst_cp <- class_prediction(
"stats::glm(Species ~ Petal.Width + Petal.Length, family='binomial', iris)",
iris,
res
)

Create a correlation_analysis instance

Description

Create a correlation_analysis instance

Usage

correlation_analysis(code_string, input_data, test_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

test_results

A data frame or a list of data frames

Value

A correlation_analysis instance

Examples

res <- data.frame(result_1 = 1, result_2 = 2)
inst_ca <- correlation_analysis(
"stats::cor.test(iris$Petal.Length, iris$Sepal.Length)",
iris,
res
)

Create a data_analysis instance

Description

Create a data_analysis instance

Usage

data_analysis(instances, code_reference = NULL)

Arguments

instances

Analytic instance or a list of instances

code_reference

A URL of the code implementing data analysis

Value

A data analysis instance

Examples

res <- data.frame(mean = 3.758)
inst_ds <- descriptive_statistics(
"base::mean(iris$Petal.Length)",
iris,
res
)
inst_da <- data_analysis(inst_ds)

Create a descriptive_statistics instance

Description

Create a descriptive_statistics instance

Usage

descriptive_statistics(code_string, input_data, test_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

test_results

A data frame or a list of data frames

Value

A descriptive_statistics instance

Examples

res <- data.frame(mean = 3.758)
inst_ds <- descriptive_statistics(
"base::mean(iris$Petal.Length)",
iris,
res
)

Create a factor_analysis instance

Description

Create a factor_analysis instance

Usage

factor_analysis(code_string, input_data, test_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

test_results

A data frame or a list of data frames

Value

A factor_analysis instance

Examples

fa_data <- iris[-5]
res <- data.frame(result_1 = 1, result_2 = 2)
inst_fa <- factor_analysis(
"stats::princomp(fa_data)",
iris,
res
)

Create a group_comparison instance

Description

Create a group_comparison instance

Usage

group_comparison(code_string, input_data, test_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

test_results

A data frame or a list of data frames

Value

A group_comparison instance

Examples

res <- data.frame(result_1 = 1, result_2 = 2)
inst_gc <- group_comparison(
"stats::aov(Petal.Length ~ Species, data = iris)",
iris,
res
)

Create a multilevel_analysis instance

Description

Create a multilevel_analysis instance

Usage

multilevel_analysis(code_string, input_data, test_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

test_results

A data frame or a list of data frames

Value

A multilevel_analysis instance

Examples

code_string <- "lme4::lmer(math ~ homework + (1 | schid))"
res <- data.frame(result_1 = 1, result_2 = 2)
inst <- multilevel_analysis(code_string, "data_url", res)

Create a regression_analysis instance

Description

Create a regression_analysis instance

Usage

regression_analysis(code_string, input_data, test_results)

Arguments

code_string

A line of code as a string, or "N/A" if not given

input_data

A data frame, a named list, or a URL as a string

test_results

A data frame or a list of data frames

Value

A regression_analysis instance

Examples

res <- data.frame(result_1 = 1, result_2 = 2)
inst_ra <- regression_analysis(
"stats::lm(Petal.Length ~ Sepal.Length, data = iris)",
iris,
res
)

Wrap stats::aov function

Description

Wrap stats::aov function

Usage

stats_aov(...)

Arguments

...

the same arguments as in the wrapped function

Value

a list of ANOVA object and R6 class instance

Examples

results <- stats_aov(Petal.Length ~ Species, data = iris)


Write an instance in JSON-LD format

Description

This function is imported from dtreg for ease-of-use

Usage

to_jsonld(instance)

Arguments

instance

An instance of an R6 class

Value

JSON string in JSON-LD format

Examples

res <- data.frame(mean = 3.758)
inst_ds <- descriptive_statistics(
"base::mean(iris$Petal.Length)",
iris,
res
)
json <- to_jsonld(inst_ds)