split_double_col: Split Two-Field Column

View source: R/sv.R

split_double_colR Documentation

Split Two-Field Column

Description

Splits a column with 2 comma-separated fields into two columns.

Usage

split_double_col(d, nms)

Arguments

d

Input tibble data.

nms

A character vector of columns to split.

Value

A modified tibble with the original columns averaged and split nicely.

Examples

x <- tibble::tibble(
  a = letters[1:11],
  b = c("0.4,0.8", paste0(round(runif(10), 2), ",", round(runif(10), 2))),
  nacol = rep(NA, 11),
  namix = sample(c(NA, "0.4,0.6"), 11, replace = TRUE)
)
(b <- gpgr:::split_double_col(x, "b"))
(nacol <- gpgr:::split_double_col(x, "nacol"))
(namix <- gpgr:::split_double_col(x, "namix"))

umccr/gpgr documentation built on April 21, 2024, 1:16 a.m.