This methods applies permutations column-wise on the coe
of any
Coe object but relies on a function that can be used on any matrix.
For a Coe object, it uses sample on every column (or row) with (or without)
replacement.
Usage
perm(x, ...)
# S3 method for default
perm(x, margin = 2, size, replace = TRUE, ...)
# S3 method for Coe
perm(x, size, replace = TRUE, ...)
Arguments
- x
the object to permute
- ...
useless here
- margin
numeric whether 1 or 2 (rows or columns)
- size
numeric the required size for the final object, same size by default.
- replace
logical, whether to use sample with replacement
See also
Other farming:
breed()
Examples
m <- matrix(1:12, nrow=3)
m
#> [,1] [,2] [,3] [,4]
#> [1,] 1 4 7 10
#> [2,] 2 5 8 11
#> [3,] 3 6 9 12
perm(m, margin=2, size=5)
#> [,1] [,2] [,3] [,4]
#> [1,] 3 4 9 11
#> [2,] 1 6 8 12
#> [3,] 3 5 7 11
#> [4,] 1 6 9 12
#> [5,] 3 4 8 12
perm(m, margin=1, size=10)
#> [,1] [,2] [,3]
#> [1,] 1 2 9
#> [2,] 10 8 3
#> [3,] 10 5 3
#> [4,] 10 11 6
#> [5,] 1 5 9
#> [6,] 4 5 9
#> [7,] 1 8 6
#> [8,] 7 11 3
#> [9,] 7 2 12
#> [10,] 4 8 3
bot.f <- efourier(bot, 12)
#> 'norm=TRUE' is used and this may be troublesome. See ?efourier #Details
bot.m <- perm(bot.f, 80)
bot.m
#> An OutCoe object [ elliptical Fourier analysis ]
#> --------------------
#> - $coe: 80 outlines described, 12 harmonics
#> # A tibble: 0 × 0