Permutes and breed Coe (and others) objects

Share:

Description

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

1
2
3
4
5
6
7
perm(x, ...)

## Default S3 method:
perm(x, margin = 2, size, replace = TRUE, ...)

## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
m <- matrix(1:12, nrow=3)
m
perm(m, margin=2, size=5)
perm(m, margin=1, size=10)

data(bot)
bot.f <- efourier(bot, 12)
bot.m <- perm(bot.f, 80)
bot.m
panel(bot.m)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.