separate_col: Turns a single character column into multiple columns.

View source: R/utilities.R

separate_colR Documentation

Turns a single character column into multiple columns.

Description

Given either a regular expression or a vector of character positions, separate_col() turns a single character column into multiple columns.

Usage

separate_col(.data, col, into, sep = "[^[:alnum:]]+")

Arguments

.data

A data frame

col

Column name

into

Names of new variables to create as character vector

sep

The separator between columns. By default, a regular expression that matches any sequence of non-alphanumeric values.

Value

A mutated .data

Examples

library(pliman)
df <- data.frame(x = paste0("TRAT_", 1:5),
                 y = 1:5)
df
separate_col(df, x, into = c("TRAT", "REP"))

pliman documentation built on Oct. 15, 2023, 1:06 a.m.

Related to separate_col in pliman...