define a data structure ("design")

Share:

Description

This function can be used to define a design. An object of class "design" is created. Descriptives can be computed.

Usage

1
2
defineDesign ( def = data.frame(), dsgn = new("design") , append = FALSE ,
descriptives = TRUE , verbose = FALSE )

Arguments

def

a data frame containing design elements in columns and units of these elements in rows, the data frame must be in "long" format, so that design elements are in columns and each row defines the units of the design elements that are combined, see example

dsgn

object of class "design"

append

logical, append def to dsgn or overwrite

descriptives

logical, compute descriptives (can be time consuming)

verbose

logical, print information while processing

Value

returns an object of class "design"

Warning

This version is beta. Use with care.

Author(s)

Martin Hecht

See Also

updateDesign design-class

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
28
# Table 7 (Frey, 2009)
table7 <- data.frame ( "Booklet" = c(1,1,2,2,3,3) , "Position" = c(1,2,1,2,1,2) ,
"Cluster" = c(1,2,2,3,3,1) )

# use table7 as the definition of the design
design7 <- defineDesign ( def = table7 )

# print design object (with auto-generated descriptives)
design7

# plot linkage of clusters (visual inspection of cluster pair balance)
plot ( design7@linkList[["Cluster|Booklet"]] )

# add some more cases, using option 'append' in 'defineDesign'
add <- data.frame ( "Booklet" = c(4,4) , "Position" = c(3,4) , "Cluster" = c(4,5) )
( design8 <- defineDesign ( def = add , dsgn = design7 , append = TRUE ) )

# add even more cases, this time using '+' operator on 2 designs
# (results are the same, but one of either method might be more convenient)
add2 <- data.frame ( "Booklet" = c(5,5,6,6) , "Position" = c(5,6,5,6) , "Cluster" = c(6,7,7,8) )
( design2 <- defineDesign ( def = add2 ) )
( design9 <- design7 + design2 )

# add items that are nested within clusters
add3 <- data.frame ( "Item" = paste ( "item" , 1:12 , sep = "" ) ,
					 "Cluster" = as.vector ( sapply ( 1:3 , rep , 4 ) ) )
( design3 <- defineDesign ( def = add3 ) )
( design10 <- design3 + design7 )

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.