as_df: Turn Momocs objects into tydy data_frames

View source: R/babel-bridges.R

as_dfR Documentation

Turn Momocs objects into tydy data_frames

Description

Used in particular for compatibility with the tidyverse

Usage

as_df(x, ...)

## S3 method for class 'Coo'
as_df(x, ...)

## S3 method for class 'Coe'
as_df(x, ...)

## S3 method for class 'PCA'
as_df(x, retain, ...)

## S3 method for class 'LDA'
as_df(x, retain, ...)

Arguments

x

an object, typically a Momocs object

...

useless here

retain

numeric for use with scree methods. Defaut to all. If ⁠<1⁠, enough axes to retain this proportion of variance; if ⁠>1⁠, this number of axes.

Value

a dplyr::tibble()

See Also

Other bridges functions: bridges, complex, export()

Examples

# first, some (baby) objects
b <- bot %>% coo_sample(12)
bf <- b %>% efourier(5, norm=TRUE)
# Coo object
b %>% as_df
# Coe object
bf %>% as_df

# PCA object
bf %>% PCA %>% as_df     # all PCs by default
bf %>% PCA %>% as_df(2) # or 2
bf %>% PCA %>% as_df(0.99) # or enough for 99%

# LDA object
bf %>% LDA(~fake) %>% as_df
# same options apply

MomX/Momocs documentation built on Nov. 18, 2023, 10:53 p.m.