Learn R Programming

amap (version 0.8-20)

burt: Compute burt table from a factor dataframe.

Description

matlogic returns for all variables a matrix of logical values for each levels. burt is defined as t(matlogic).matlogic

Usage

burt(x)
matlogic(x)

Arguments

x

A dataframe that contents only factors

Author

Antoine Lucas

Examples

Run this code
color <- as.factor(c('blue','red','red','blue','red'))
size <- as.factor(c('large','large','small','medium','large'))
x <- data.frame(color,size)

matlogic(x)
##  color.blue color.red size.large size.medium size.small
##1          1         0          1           0          0
##2          0         1          1           0          0
##3          0         1          0           0          1
##4          1         0          0           1          0
##5          0         1          1           0          0

burt(x)
##              color.blue color.red size.large size.medium size.small
##  color.blue           2         0          1           1          0
##  color.red            0         3          2           0          1
##  size.large           1         2          3           0          0
##  size.medium          1         0          0           1          0
##  size.small           0         1          0           0          1

Run the code above in your browser using DataLab