Learn R Programming

easyr (version 0.3-1)

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)

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.

Value

Transposed tibble.

Examples

Run this code
# NOT RUN {
 # 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