ratings: Extract ratings (wide or long format)

Description Usage Arguments Value Author(s) See Also Examples

View source: R/repgrid-basicops.r

Description

Extract ratings (wide or long format)

Usage

1
2
3
4
5
ratings(x, names = TRUE, trim = 10)

ratings_df(x, long = FALSE, names = TRUE, trim = NA)

ratings(x, i, j) <- value

Arguments

x

A repgrid object.

names

Extract row and columns names (constructs and elements).

trim

The number of characters a row or column name is trimmed to (default is 10). If NA no trimming is done. Trimming simply saves space when displaying the output.

long

Return as long format? (default FALSE)

i, j

Row and column indices.

value

Numeric replacement value(s).

Value

A matrix.#'

Author(s)

Mark Heckmann

See Also

`[<--method`

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
## store Bell's dataset in x
x <- bell2010

## get ratings
ratings(x)


## replace ratings   
       
ratings(x)[1,1] <- 1
# noet that this is even simpler using the repgrid object directly
x[1,1] <- 2

#replace several values

ratings(x)[1,1:5] <- 1
x[1,1:5] <- 2   # the same

ratings(x)[1:3,5:6] <- matrix(5, 3, 2)
x[1:3,5:6] <- matrix(5, 3, 2)   # the same


## ratings as dataframe in wide or long format

ratings_df(x)
ratings_df(x, long = TRUE)

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