indicator: Indicator matrix

Description Usage Arguments Value See Also Examples

View source: R/functions_analysis.r

Description

Creates an indicator matrix from a data.frame with the categories of the questions as columns and individuals as rows.

Usage

1
indicator(x, id = NULL, ps = ": ")

Arguments

x

a data.frame of factors

id

a vector defining the labels for the individuals. If id = NULL row number is used.

ps

the seperator used in the creation of the names of the columns.

Value

Returns a indicator matrix

See Also

soc.mca

Examples

1
2
3
a  <- rep(c("A","B"), 5)
b  <- rep(c("C", "D"), 5)
indicator(data.frame(a,b))

Example output

Loading required package: ggplot2
   a: A a: B b: C b: D
1     1    0    1    0
2     0    1    0    1
3     1    0    1    0
4     0    1    0    1
5     1    0    1    0
6     0    1    0    1
7     1    0    1    0
8     0    1    0    1
9     1    0    1    0
10    0    1    0    1

soc.ca documentation built on Sept. 5, 2021, 5:21 p.m.

Related to indicator in soc.ca...