bridges: Convert between different classes

bridgesR Documentation

Convert between different classes

Description

Convert between different classes

Usage

l2m(l)

m2l(m)

d2m(d)

m2d(m)

l2a(l)

a2l(a)

a2m(a)

m2a(m)

m2ll(m, index = NULL)

Arguments

l

list with x and y coordinates as components

m

matrix of (x; y) coordinates

d

data.frame with two columns

a

array of (x; y) coordinates

index

numeric, the number of coordinates for every slice

Value

the data in the required class

Note

a2m/m2a change, by essence, the dimension of the data. m2ll is used internally to hanle coo and cur in Ldk objects but may be useful elsewhere

See Also

Other bridges functions: as_df(), complex, export()

Examples

# matrix/list
wings[1] %>% coo_sample(4) %>%
   m2l() %T>% print %>%        # matrix to list
   l2m()                       # and back

# data.frame/matrix
wings[1] %>% coo_sample(4) %>%
   m2d() %T>% print %>%        # matrix to data.frame
   d2m                         # and back

 # list/array
 wings %>% slice(1:2) %$%
 coo %>% l2a %T>% print %>%    # list to array
 a2l                           # and back

 # array/matrix
 wings %>% slice(1:2) %$%
 l2a(coo) %>%                  # and array (from a list)
 a2m %T>% print %>%            # to matrix
 m2a                           # and back

 # m2ll
m2ll(wings[1], c(6, 4, 3, 5)) # grab slices and coordinates

Momocs documentation built on Nov. 13, 2023, 5:07 p.m.

Related to bridges in Momocs...