ratings {OpenRepGrid}R Documentation

Extract ratings (wide or long format)

Description

Extract ratings (wide or long format)

Usage

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.#'

See Also

⁠[<--method⁠

Examples


## 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)


[Package OpenRepGrid version 0.1.15 Index]