A standard (value-oriented) interface for gather. 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.

gather_se(
  data,
  ...,
  key = "key",
  value = "value",
  columns = NULL,
  na.rm = FALSE,
  convert = FALSE,
  factor_key = FALSE,
  use_one_of = TRUE
)

Arguments

data

data.frame to take values from.

...

not used, force later arguments to bind by name.

key

character, name for new column to record which columns values were taken from.

value

character, name for new column to record values.

columns

character, names of columns to take values from.

na.rm

passed to gather.

convert

passed to gather.

factor_key

passed to gather.

use_one_of

logical, if TRUE use dplyr::one_of() instead of rlang:::`!!!`.

Value

converted data.

See also

Examples

d <- wrapr::build_frame( 'id', 'measurement1', 'measurement2' | 1 , 'a' , 10 | 2 , 'b' , 20 ) gather_se(d, key = "value_came_from_column", value = "value_was", columns = c("measurement1", "measurement2"))
#> id value_came_from_column value_was #> 1 1 measurement1 a #> 2 2 measurement1 b #> 3 1 measurement2 10 #> 4 2 measurement2 20