spread_se: Collect values from blocks of rows into columns.

View source: R/spread_se.R

spread_seR Documentation

Collect values from blocks of rows into columns.

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

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


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')


WinVector/seplyr documentation built on Aug. 26, 2022, 12:01 p.m.