spread_se: Collect values from blocks of rows into columns.

Description Usage Arguments Value See Also Examples

View source: R/spread_se.R

Description

Standared inteface to spread. Take values from the columns named in the columns argument and move them into blocks of rows, placing values in the new column specified by value and indicating which column each value came from in the new column specified by key.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
spread_se(
  data,
  key,
  value,
  ...,
  fill = NA,
  convert = FALSE,
  drop = TRUE,
  sep = NULL
)

Arguments

data

data.frame to take values from.

key

character, name for existing column to get new column names from.

value

character, name for existing column to take values from.

...

not used, force later arguments to bind by name.

fill

passed to spread.

convert

passed to spread.

drop

passed to spread.

sep

passed to spread.

Value

converted data.

See Also

spread, gather_se

Examples

1
2
3
4
5
6
7
8
9
d <- wrapr::build_frame(
    'id', 'name_for_new_column' , 'value_to_take' |
    1   , 'col1'                , 'a'             |
    1   , 'col2'                , '10'            |
    2   , 'col1'                , 'b'             |
    2   , 'col2'                , '20'            )
spread_se(d,
   key = 'name_for_new_column',
   value = 'value_to_take')

seplyr documentation built on Sept. 5, 2021, 5:12 p.m.