constructs: Get or replace construct poles

Description Usage Arguments Examples

View source: R/repgrid-constructs.r

Description

Allows to get and set construct poles. Replaces the older functions getConstructNames, getConstructNames2, and eNames which are deprecated.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
constructs(x, collapse = FALSE, sep = " - ")

constructs(x, i, j) <- value

leftpoles(x)

leftpoles(x, position) <- value

rightpoles(x)

rightpoles(x, position) <- value

Arguments

x

A repgrid object.

collapse

Return vector with both poles instead.

sep

Seperator if collapse = TRUE, default is " - ".

value

Character vector of poles.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# shorten object name
x <- boeker

## get construct poles
constructs(x)   # both left and right poles
leftpoles(x)    # left poles only
rightpoles(x)
constructs(x, collapse = TRUE)

## replace construct poles
constructs(x)[1,1] <- "left pole 1"
constructs(x)[1,"leftpole"] <- "left pole 1"  # alternative
constructs(x)[1:3,2] <- paste("right pole", 1:3)
constructs(x)[1:3,"rightpole"] <- paste("right pole", 1:3) # alternative
constructs(x)[4,1:2] <- c("left pole 4", "right pole 4")

l <- leftpoles(x)
leftpoles(x) <- sample(l)             # brind poles into random order
leftpoles(x)[1] <- "new left pole 1"  # replace name of first left pole

# replace left poles of constructs 1 and 3
leftpoles(x)[c(1,3)] <- c("new left pole 1", "new left pole 3")
 

markheckmann/OpenRepGrid documentation built on April 30, 2021, 2:33 a.m.