| mkt2 | R Documentation |
Make tibble from two vectors x and y. The two vectors are re-organised in a data frame with column 1 for group labels as factors and column 2 for observations.
mkt2(
x,
y,
gr_names = "gr",
obs_names = "obs",
group_labels = c("Group1", "Group2")
)
x, y |
Two vectors. |
gr_names |
The name of the first column - default "gr" for groups. |
obs_names |
The name of the second column - default "obs" for observations. |
A tibble - see details in tibble.
# Generate two vectors
g1 <- rnorm(10)
g2 <- rnorm(10)
# Make tibble using default parameters
df <- mkt2(g1, g2)
# Make tibble using custom parameters
df <- mkt2(g1, g2, gr_names = "groups", obs_names = "values", group_labels =
c("group1", "group2"))
# For instance, vectors x & y:
x <- c(1, 2, 3, 4, 5)
y <- c(11, 12, 13, 14, 15)
df <- mkt2(x, y)
# become a tibble: 10 × 2:
gr obs
<fctr> <dbl>
1 Group1 1
2 Group1 2
3 Group1 3
4 Group1 4
5 Group1 5
6 Group2 11
7 Group2 12
8 Group2 13
9 Group2 14
10 Group2 15
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.