makeSCDF: Create a single case data frame for further analyses

Description Usage Arguments Value Author(s) See Also Examples

View source: R/makeSCDF.R

Description

The makeSCDF function creates the basic data structure for one or multiple single-cases. This basic data structure is required in all scan functions.

Usage

1
makeSCDF(data, B.start = NULL, MT = NULL, phase.length = NULL, pvar = NULL)

Arguments

data

A vector containing measurement values of the target variable.

B.start

The first measurement of phase B (simple coding if design is strictly AB).

MT

A vector defining measurement times. Default is MT = (1,2,3,...,n).

phase.length

A vector defining the length and label of each phase. E.g., phase.length = c(A1 = 10, B1 = 10, A2 = 10, B2 = 10).

pvar

A list with additional variables. E.g., pvar = list(teacher = c(0,1,0,1,0,0,1), lesson = c(1,3,4,5,2,3).

Value

Returns a data frame formatted as a single-case data frame suitable for all functions of the scan package. Multiple data sets (e.g. from Multiple Baseline Designs) can be listed.

Author(s)

Juergen Wilbert

See Also

longSCDF, makesingleSC, writeSC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Scores on a letter naming task were collected on eleven days in a row. The intervention
## started after the fifth measurement, so the first B phase measurement was 6 (B.start = 6).
klaas <- makeSCDF(c(5, 7, 8, 5, 7, 12, 16, 18, 15, 14, 19), B.start = 6)
plotSC(klaas)

## Unfortunately in a similar SCDR there were no data collected on days 3 and 9. Use NA to
## pass them to the package.
emmi <- makeSCDF(c(5, 7, NA, 5, 7, 12, 16, 18, NA, 14, 19), B.start = 6)
describeSC(emmi)

## In a MBD over three persons, data were again collected eleven days in a row. Intervention
## starting points differ between subjects as they were randomly assigned. The three SCDFs
## are then combined in a list for further conjoined analyses.
charlotte <- makeSCDF(c(5, 7, 10, 5, 12, 7, 10, 18, 15, 14, 19), 6)
theresa <- makeSCDF(c(3, 4, 3, 5, 7, 4, 7, 9, 8, 10, 12),5)
antonia <- makeSCDF(c(9, 8, 8, 7, 5, 7, 6, 14, 15, 12, 16), 7)
mbd <- list(charlotte, theresa, antonia)
names(mbd) <- c("Charlotte", "Theresa", "Antonia")
overlapSC(mbd)

## In a classroom-based intervention it was not possible to measure outcomes every day, but
## only on schooldays. The sequence of measurements is passed to the package by using a
## vector of measurement times.
frida <- makeSCDF(c(3, 2, 4, 2, 2, 3, 5, 6, 8, 10, 8, 12, 14, 13, 12), B.start = 9,
    MT = c(1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18))
plotSC(frida)
describeSC(frida)

scan documentation built on June 20, 2017, 3:01 p.m.