mkt1: Make tibble (data frame) for one group

View source: R/utils.R

mkt1R Documentation

Make tibble (data frame) for one group

Description

Make tibble from one vector x. The vector is re-organised in a data frame with column 1 for group label and column 2 for observations.

Usage

mkt1(x, name = c("obs", "gr"))

Arguments

x

A vector.

gr_names

The name of the first column - default "gr" for groups.

obs_names

The name of the second column - default "obs" for observations.

Value

A tibble - see details in tibble.

Examples

# Generate one vector
g1 <- rnorm(10)

# Make tibble using default parameters
df <- mkt1(g1)

# Make tibble using custom parameters
df <- mkt1(g1, gr_names = "groups", obs_names = "values", group_label =
"group1")

# For instance, vector x:
x <- c(1, 2, 3, 4, 5)
df <- mkt1(x)
# become a tibble: 5 × 2:
       gr   obs
   <fctr> <dbl>
1  Group1     1
2  Group1     2
3  Group1     3
4  Group1     4
5  Group1     5

GRousselet/rogme documentation built on Nov. 12, 2022, 4:38 a.m.