teshape: Interconvert data structures

Description Usage Arguments Details Value Examples

View source: R/teshape.r

Description

Interconvert an array, a raw data frame, and frequency distribution data.frame.

Usage

1
teshape(data, out = c("freq", "tab", "raw"))

Arguments

data

a data frame or array

out

the output format, see examples

Details

Multivariate categorical data can be represented in several ways. Three comon ways are : a contingency table, a data frame of raw observations (1 row = 1 subject), and a long data frame with a variable containing the counts in the contingency table.

Value

a matrix containing the Markov basis as its columns (for easy addition to tables)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(Titanic)

# array to others
teshape(Titanic, "freq")
teshape(Titanic, "tab") # what it was
teshape(Titanic, "raw")


# freq to others
TitanicFreq <- teshape(Titanic, "freq")
teshape(TitanicFreq, "freq") # what it was
teshape(TitanicFreq, "tab")  # == Titanic
teshape(TitanicFreq, "raw")

# raw to others
TitanicRaw <- teshape(Titanic, "raw")
teshape(TitanicRaw, "freq")
teshape(TitanicRaw, "tab")
teshape(TitanicRaw, "raw")

algstat documentation built on May 29, 2017, 10:34 p.m.

Related to teshape in algstat...