f_manip_matrix_2_tibble: converts matrices to tibble, preserving row.names

Description Usage Arguments Value Examples

View source: R/f_manip.R

Description

row.names are added as row_names column as the first column of the tibble. Function does not fail when object cannot be converted to tibble thus can be used to map over lists with various variable types such as modells and objects.

Usage

1

Arguments

x

any variable

Value

a tibble or if the input variable is neither matrix dataframe or tibble the original input object.

Examples

1
2
3
4
5
6
7
8
mat = as.matrix(mtcars)
head( mat, 10)
f_manip_matrix_2_tibble( mat )

# convert all matrices from a list
pca = prcomp( mtcars ) %>%
 map( f_manip_matrix_2_tibble )
pca

erblast/oetteR documentation built on April 5, 2018, 9:03 a.m.