Learn R Programming

pastecs (version 1.0-2)

disjoin: Complete disjoined coded data (binary coding)

Description

Transform a factor in separate variables (one per level) with a binary code (0 for absent, 1 for present) in each variable

Usage

disjoin(x)

Arguments

x
a vector containing a factor data

Value

  • a matrix containing the data with binary coding

Details

Use cut() to transform a numerical variable into a factor variable

References

Fromentin J.-M., F. Ibanez & P. Legendre, 1993. A phytosociological method for interpreting plankton data. Mar. Ecol. Prog. Ser., 93:285-306. Gebski, V.J., 1985. Some properties of splicing when applied to non-linear smoothers. Comput. Stat. Data Anal., 3:151-157. Grandjouan, G., 1982. Une m�thode de comparaison statistique entre les r�partitions des plantes et des climats. Th�se d'Etat, Universit� Louis Pasteur, Strasbourg. Ibanez, F., 1976. Contribution � l'analyse math�matique des �v�nements en Ecologie planctonique. Optimisations m�thodologiques. Bull. Inst. Oc�anogr. Monaco, 72:1-96.

See Also

buysbal, cut

Examples

Run this code
# Artificial data with 1/5 of zeros
Z <- c(abs(rnorm(8000)), rep(0, 2000))
# Let the program chose cuts
table(cut(Z, breaks=5))
# Create one class for zeros, and 4 classes for the other observations
Z2 <- Z[Z != 0]
cuts <- c(-1e-10, 1e-10, quantile(Z2, 1:5/5, na.rm=TRUE))
cuts
table(cut(Z, breaks=cuts))
# Binary coding of these data
disjoin(cut(Z, breaks=cuts))[1:10, ]

Run the code above in your browser using DataLab