Skip to contents

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)
#>                          elements
#> constructs                self closest fr the unhapp A person o A teacher 
#>   relaxed - worried &        4          4          6          5          3
#>   not so sma - smart (aca    6          7          6          5          7
#>   dislikes s - loves spor    6          3          7          6          4
#>   not intera - loves peop    6          7          5          6          6
#>   not transp - transparen    6          4          5          7          3
#>   insensitiv - sensitive     4          6          5          4          4
#>   fearful&ti - fearless      5          4          4          6          5
#>   rough - gentle             5          6          6          4          5
#>   accept as  - loves to a    5          5          6          7          4
#>                          elements
#> constructs                Mother (or A person o The most c A person y
#>   relaxed - worried &              6          5          2          2
#>   not so sma - smart (aca          4          6          7          4
#>   dislikes s - loves spor          4          2          3          6
#>   not intera - loves peop          5          6          7          7
#>   not transp - transparen          7          6          5          6
#>   insensitiv - sensitive           6          5          3          4
#>   fearful&ti - fearless            3          5          6          5
#>   rough - gentle                   7          7          3          5
#>   accept as  - loves to a          4          6          7          5
#>                          elements
#> constructs                A teacher 
#>   relaxed - worried &              6
#>   not so sma - smart (aca          7
#>   dislikes s - loves spor          3
#>   not intera - loves peop          4
#>   not transp - transparen          3
#>   insensitiv - sensitive           2
#>   fearful&ti - fearless            5
#>   rough - gentle                   6
#>   accept as  - loves to a          5


## 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)
#>   construct_index                    leftpole            rightpole self
#> 1               1                     relaxed      worried & tense    2
#> 2               2 not so smart (academically) smart (academically)    6
#> 3               3             dislikes sports         loves sports    6
#> 4               4             not interactive         loves people    6
#> 5               5             not transparent          transparent    6
#> 6               6                 insensitive            sensitive    4
#> 7               7               fearful&timid             fearless    5
#> 8               8                       rough               gentle    5
#> 9               9             accept as it is       loves to argue    5
#>   closest friend of the same sex the unhappiest person you know
#> 1                              2                              2
#> 2                              7                              6
#> 3                              3                              7
#> 4                              7                              5
#> 5                              4                              5
#> 6                              6                              5
#> 7                              4                              4
#> 8                              6                              6
#> 9                              5                              6
#>   A person of the opposite sex that you don't get along with
#> 1                                                          2
#> 2                                                          5
#> 3                                                          6
#> 4                                                          6
#> 5                                                          7
#> 6                                                          4
#> 7                                                          6
#> 8                                                          4
#> 9                                                          7
#>   A teacher you respected Mother (or the person who filled that kind of role)
#> 1                       5                                                   5
#> 2                       5                                                   5
#> 3                       5                                                   5
#> 4                       6                                                   5
#> 5                       3                                                   7
#> 6                       4                                                   6
#> 7                       5                                                   3
#> 8                       5                                                   7
#> 9                       4                                                   4
#>   A person of the opposite sex that you like more than you dislike
#> 1                                                                5
#> 2                                                                6
#> 3                                                                2
#> 4                                                                6
#> 5                                                                6
#> 6                                                                5
#> 7                                                                5
#> 8                                                                7
#> 9                                                                6
#>   The most confident person you know
#> 1                                  2
#> 2                                  7
#> 3                                  3
#> 4                                  7
#> 5                                  5
#> 6                                  3
#> 7                                  6
#> 8                                  3
#> 9                                  7
#>   A person you work well with (at job or on sports team etc)
#> 1                                                          2
#> 2                                                          4
#> 3                                                          6
#> 4                                                          7
#> 5                                                          6
#> 6                                                          4
#> 7                                                          5
#> 8                                                          5
#> 9                                                          5
#>   A teacher you did not respect
#> 1                             6
#> 2                             7
#> 3                             3
#> 4                             4
#> 5                             3
#> 6                             2
#> 7                             5
#> 8                             6
#> 9                             5
ratings_df(x, long = TRUE)
#> # A tibble: 90 × 5
#>    construct_index leftpole rightpole       element                       rating
#>              <int> <chr>    <chr>           <chr>                          <dbl>
#>  1               1 relaxed  worried & tense self                               2
#>  2               1 relaxed  worried & tense closest friend of the same s…      2
#>  3               1 relaxed  worried & tense the unhappiest person you kn…      2
#>  4               1 relaxed  worried & tense A person of the opposite sex…      2
#>  5               1 relaxed  worried & tense A teacher you respected            5
#>  6               1 relaxed  worried & tense Mother (or the person who fi…      5
#>  7               1 relaxed  worried & tense A person of the opposite sex…      5
#>  8               1 relaxed  worried & tense The most confident person yo…      2
#>  9               1 relaxed  worried & tense A person you work well with …      2
#> 10               1 relaxed  worried & tense A teacher you did not respect      6
#> # ℹ 80 more rows