Description Usage Arguments Value Examples
Reshape to Wide Format
1 | reshape_towide(data, id, col_change, prefix, suffix, sep = "_")
|
data |
long data |
id |
column names for id, which can be one or more |
col_change |
column names for exchange, which can be one or more |
prefix |
column names for prefix, which can be one or more |
suffix |
column names for suffix, which can be one or more |
sep |
seperation |
A wide data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | df = data.frame(id = c(1,1,2,2,3,3,4,4),
time = c(1,2,1,2,1,2,1,2),
w = c(1,6,2,7,3,8,4,9))
reshape_towide(data = df,
id = 'id',
col_change = 'time',
prefix = 'w')
df = data.frame(id = c(1,1,2,2,3,3,4,4),
time = c(1,2,1,2,1,2,1,2),
w = c(1,6,2,7,3,8,4,9),
h = c(5,1,6,3,7,5,8,7),
n = c(2,2,3,3,4,4,5,5))
reshape_towide(data = df,
id = 'id',
col_change = c('time','n'),
prefix = 'w',sep = '_')
reshape_towide(data = df,
id = 'id',
col_change = 'time',
prefix = c('w','h'))
reshape_towide(data = df,
id = c('id','n'),
col_change = 'time',
prefix = c('w','h'))
df = data.frame(id = c(1,1,2,2,3,3,4,4),
time = c('a','a','a','b','b','b','c','c'),
n=c(5,5,6,6,7,7,8,8))
reshape_towide(data = df,id = 'id',col_change = 'time')
reshape_towide(data = df,id = c('id','time'),col_change = 'n')
reshape_towide(data = df,id = 'id',col_change = c('time','n'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.