Learn R Programming

easyr (version 0.5-11)

tcol: Transpose at Column.

Description

Transpose operation that sets column names equal to a column in the original data. Author: Bryce Chamberlain.

Usage

tcol(x, header, cols.colname = "col", do.atype = TRUE)

Value

Transposed data frame.

Arguments

x

Data frame to be transposed.

header

Column name/number to be used as column names of transposed data.

cols.colname

Name to use for the column of column names in the transposed data.

do.atype

Transpose convertes to strings, since data types are uncertain. Run atype to automatically correct variable typing where possible. This will slow the result a bit.

Examples

Run this code
 # create a summary dataset from iris.
 x = dplyr::summarize_at( 
  dplyr::group_by( iris, Species ), 
  dplyr::vars( Sepal.Length, Sepal.Width ), list(sum) 
 )
 # run tcol
 tcol( x, 'Species' )

Run the code above in your browser using DataLab