Learn R Programming

safeframe: Generic Data Tagging and Validating

safeframe provides functions to tag and validate data of any kind. safeframe is an abstraction of linelist, which originally applied these principles to epidemiological linelist data. The original proposal for this package can be found on the Discussion board.

Installation

You can install safeframe from CRAN (release) or GitHub (development):

# CRAN
install.packages('safeframe')

# Development
# install.packages("pak")
pak::pak("epiverse-trace/safeframe")

Getting started

library(safeframe)

# Create a safeframe object
x <- make_safeframe(cars, mph = "speed", distance = "dist")

# Validate the tagged data are of a specific type
validate_safeframe(x,
  mph = 'numeric',        # speed should be numeric
  # type() is a helper function of related classes
  distance = type('numeric')    # dist should be numeric, integer
)

Development

Lifecycle

This package is currently maturing, as defined by the RECON software lifecycle:

Package is functional, documented and tested. Can be used in production with the understanding that the interface may still undergo minor changes. Typically semantic version < 1.0.0.

Contributions

Contributions are welcome via pull requests. Anything bigger than a typo fix or a small documentation update should be discussed in an issue first. If you want to report a bug or suggest an enhancement, please open an issue.

Copy Link

Version

Install

install.packages('safeframe')

Monthly Downloads

124

Version

1.0.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Chris Hartgerink

Last Published

June 27th, 2025

Functions in safeframe (1.0.0)

validate_tags

Checks the tags of a safeframe object
print.safeframe

Printing method for safeframe objects
make_safeframe

Create a safeframe from a data.frame
[.safeframe

Subsetting of safeframe objects
type

Type Selection Helper
tags

Get the list of tags in a safeframe
tags_df

Extract a data.frame of all tagged variables
safeframe-package

Base Tools for Tagging and Validating Data
set_tags

Change tags of a safeframe object
validate_safeframe

Checks the content of a safeframe object
validate_types

Type check variables
vars_tags

Internal printing function for variables and tags
has_tag

A selector function to use in tidyverse functions
lost_tags_action

Check and set behaviour for lost tags