split_by: Split a Dataframe

Description Usage Arguments See Also Examples

View source: R/split.R

Description

Split a Dataframe

Usage

1
split_by(data, col, drop = FALSE, sep = ".", lex.order = FALSE)

Arguments

data

A dataframe or tibble.

col

Target column.

drop

logical indicating if levels that do not occur should be dropped (if f is a factor or a list).

sep

character string, passed to interaction in the case where f is a list.

lex.order

logical, passed to interaction when f is a list.

See Also

split select

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(tidyverse)
test_data <- 
        tibble(
                Group = sample(c("Apple", "Pear"), size = 10, replace = TRUE),
                A     = sample(c(NA_integer_, 1:3), size = 10, replace = TRUE),
                B     = sample(c(NA_integer_, 4:6), size = 10, replace = TRUE)
        )


# Split
split_by(test_data,
         col = Group)

# Split Deselect
split_deselect(test_data,
               col = Group)

meerapatelmd/rubix documentation built on Sept. 5, 2021, 8:30 p.m.