parse_usubjid: Recombine pieces of a delimited string

View source: R/transforms_text.R

parse_usubjidR Documentation

Recombine pieces of a delimited string

Description

Recombine pieces of a delimited string

Usage

parse_usubjid(id, pick_parts, sep = "-", max_parts = 5)

Arguments

id

The USUBJID values

pick_parts

a numeric value or vector specifying which parts to recombine and in which order

sep

The delimiter between the parts.

max_parts

The maximum number of parts to allow for.

Details

Intended for use in simplifying USUBJID values, this function takes a column of text USUBJIDs, splits them by their delimiter ("-") and allows for recombining the parts.

Value

A vector of the recombined elements from id.

Examples

parse_usubjid(c("1-2-3-4-5","3-28-123-12-41"),5)
# "5" "41"
parse_usubjid(c("1-2-3-4-5","3-28-123-12-41"),c(1,5))
# "15"  "341"

qPharmetra/PMDatR documentation built on April 7, 2024, 5:42 p.m.