swap_columns: Swap positions (so names and values both) for two columns...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/swap_columns.R

Description

Takes a data frame and two character strings. The character strings must match exactly to the column names of two columns in the data frame. The returned value is the same data frame, but with the column positions of the two columns named interchanged.

Usage

1
swap_columns(XX, column_name_01, column_name_02)

Arguments

XX

data.frame with two or more columns.

column_name_01

character string with the name of first column.

column_name_02

character string with the name of first column.

Value

a data.frame with the two named columns interchanged.

Author(s)

Bill Forrest forrest@gene.com

See Also

data.frame

Examples

1
2
3
  ### avoid a ':::'-related warning in package check by not running next lines:
   dat <- data.frame( A = letters[1:10], X = 1:10, Y = rnorm( 10 ) )
   dat_swap <- maeve:::swap_columns( dat, 'X', 'Y' )

wfforrest/maeve documentation built on Jan. 1, 2021, 12:47 p.m.