conversion {ANOPA}R Documentation

Converting between formats

Description

The functions 'toWide()', 'toLong()', and 'toCompiled()' converts the data into various formats.

Usage

toWide(w)

toLong(w)

toCompiled(w)

Arguments

w

An instance of an ANOPA object.

Details

The proportions of success of a set of n participants can be given using many formats. In what follows, n is the number of participants, p is the number of between-subject factor(s), $q$ is the number of repeated-measure factor(s).

See the vignette DataFormatsForProportions for more.

Value

A data frame in the requested format.

Examples


# The minimalBSExample contains $n$ of 175 participants categorized according
# to one factor $f = 1$, namely `State of residency` (with three levels) 
# for 3 possible cells.
minimalBSExample

# Lets incorporate the data in an ANOPA data structure
w <- anopa( {s;n} ~ state, minimalBSExample )

# The data presented using various formats looks like
toWide(w)
# ... has 175 lines, one per participants ($n$) and 2 columns (state, success or failure)

toLong(w)
# ... has 175 lines ($n x f$) and 4 columns (participant's `Id`, state name, measure name, 
# and success or failure)

toCompiled(w)
# ... has 3 lines and 3 columns ($f$ + 2: number of succes and number of participants).


# This second example is from a mixed-design. It indicates the 
# state of a machine, grouped in three categories (the sole between-subject
# factor) and at four different moments. 
# The four measurements times are before treatment, post-treatment, 
# 1 week later, and finally, 5 weeks later.
minimalMxExample

# Lets incorporate the data in an ANOPA data structure
w <- anopa( cbind(bpre,bpost,b1week,b5week) ~ Status, 
            minimalMxExample,
            WSFactors = "Moment(4)" )

# -- Wide format --
# Wide format is actually the format of minimalMxExample
# (27 lines with 8 subjects in the first group and 9 in the second)
toWide(w)

# -- Long format --
# (27 times 4 lines = 108 lines, 4 columns, that is Id, group, measurement, success or failure)
toLong(w)

# -- Compiled format --
# (three lines as there are three groups, 7 columns, that is, 
# the group, the 4 measurements, the number of particpants, and the
# correlation between measurements for each group measured by unitary alphas)
toCompiled(w)




[Package ANOPA version 0.1.3 Index]