unpivot: unpivot data matrix

Description Usage Arguments Examples

View source: R/unpivot.R

Description

unpivot data matrix

Usage

1

Arguments

m

matrix or dataframe

Examples

1
2
3
4
5
x = matrix(1:25,ncol=5)
x = as.data.frame(x)
colnames(x) = letters[1:5]
rownames(x) = LETTERS[1:5]
unpivot(x)

Example output

   rep.rownames.m...ncol.m.. rep.colnames.m...each...nrow.m.. c.m.
1                          A                                a    1
2                          B                                a    2
3                          C                                a    3
4                          D                                a    4
5                          E                                a    5
6                          A                                b    6
7                          B                                b    7
8                          C                                b    8
9                          D                                b    9
10                         E                                b   10
11                         A                                c   11
12                         B                                c   12
13                         C                                c   13
14                         D                                c   14
15                         E                                c   15
16                         A                                d   16
17                         B                                d   17
18                         C                                d   18
19                         D                                d   19
20                         E                                d   20
21                         A                                e   21
22                         B                                e   22
23                         C                                e   23
24                         D                                e   24
25                         E                                e   25

quantable documentation built on May 2, 2019, 4:05 p.m.

Related to unpivot in quantable...