noiseInjector.swapper: Swap phenotypes between samples

View source: R/noise_injectors.R

noiseInjector.swapperR Documentation

Swap phenotypes between samples

Description

This function introduces swap noise, i.e. a number of couples of samples will have their phenotypes swapped.
The number of couples is computed so that the total fraction of interested phenotypes approximates subset.

Usage

noiseInjector.swapper(phenotypes, subset = 0.1)

Arguments

phenotypes

an array of numbers

subset

fraction of phenotypes to be interested by noise.

Value

the same passed phenotypes, but with some elements swapped

See Also

Other noiseInjectors: noiseInjector.dummy(), noiseInjector.norm(), noiseInjector.unif()

Examples

#a set of phenotypes
phenos = 1:10
#swapping two elements
phenos.sw2 = noiseInjector.swapper(phenos, 0.2)
#swapping four elements
phenos.sw4 = noiseInjector.swapper(phenos, 0.4)
#swapping four elements again, since 30% of 10 elements
#is rounded to 4 (two couples)
phenos.sw4.again = noiseInjector.swapper(phenos, 0.3)

GROAN documentation built on Nov. 28, 2022, 5:07 p.m.