add_problems: Add ISO 8601 parsing problems

View source: R/dtc_problems.R

add_problemsR Documentation

Add ISO 8601 parsing problems

Description

add_problems() annotates the returned value of create_iso8601() with possible parsing problems. This annotation consists of a tibble of problems, one row for each parsing failure (see Details section).

Usage

add_problems(x, is_problem, dtc)

Arguments

x

A character vector of date-times in ISO 8601 format; typically, the output of format_iso8601().

is_problem

A logical indicating which date/time inputs are associated with parsing failures.

dtc

A list of character vectors of dates, times or date-times' components. Typically, this parameter takes the value passed in ... to a create_iso8601() call.

Details

This function annotates its input x, a vector date-times in ISO 8601 format, by creating an attribute named problems. This attribute's value is a tibble of parsing problems. The problematic date/times are indicated by the logical vector passed as argument to is_problem.

The attribute problems in the returned value will contain a first column named ..i that indicates the date/time index of the problematic date/time in x, and as many extra columns as there were inputs (passed in dtc). If dtc is named, then those names are used to name the extra columns, otherwise they get named sequentially like so ..var1, ..var2, etc..

Value

Either x without any modification, if no parsing problems exist, or an annotated x, meaning having a problems attribute that holds parsing issues (see the Details section).


sdtm.oak documentation built on April 3, 2025, 9:37 p.m.