There are three different dataframe formats from which a repgrid
object can be created:
Columns are a) element_columns
, b) construct_columns
, c) long
.
Three corresponding sample dataframes, (df_element_columns, df_construct_columns, and df_long) are included
in the package (see examples). See Detail section below for more info.
Arguments
- x
A dataframe. See Detail section and examples for required format.
- format
One of
element_columns
(default),construct_columns
, orlong
. See corresponding sections below.- rmin, rmax
Min and max of rating scale.
- pole_sep
Character(s) to seperate the constructs poles (defaults to a colon) for format
construct_columns
. Without a separator, constructs are used as right poles, all left poles will beNA
.
Format element_columns
In this format, each element has a separate column, and each row contains the ratings for one construct. It is a common way to represent grid data and looks like this.
1 | element_1 | element_2 | element_3 | element_4 | 5 | preferred |
left_pole_1 | 1 | 5 | 3 | 4 | right_pole_1 | left |
left_pole_2 | 3 | 1 | 1 | 3 | right_pole_2 | right |
left_pole_3 | 4 | 2 | 5 | 1 | right_pole_3 | NA |
The columns names contains the minimum of the rating scale (1
), the names of the elements (element_1
to
element_4
), the maximum of the rating scale (5
), and optionally the column preferred
, indicating the preferred
pole. Each row contains the constructs entries (left pole, ratings, right pole, preferred pole). The preferred pole
must be one of left
, right
, none
, NA
(see preferredPoles()
). See sample dataframe df_element_columns.
Format construct_columns
In this format, each construct has a separate column, and each row contains represents element. This format often results when summarising data (see examples). It looks like this:
The first column is named elements
followed by the constructs. The construct poles are separated by a colon by
default (see arg pole_sep
). The rows below contain the elements' entries (element name, ratings). The min and max
of the rating scale should be passed explicitly via the args rmin
and rmax
. See sample dataframe
df_construct_columns.
elements | left_pole_1:right_pole_1 | left_pole_2:right_pole_2 | left_pole_3:right_pole_3 |
element_1 | 1 | 5 | 3 |
element_2 | 3 | 1 | 1 |
element_3 | 4 | 2 | 5 |
Format long
The long
format gets its name from the fact, that it has less columns, but many more rows. It is a common format
in data analytics. Here, each row contains a different element-construct combination and the corresponding rating
value. The format looks like this:
element | left_pole | right_pole | rating | preferred_pole | rmin | rmax |
element 1 | left pole 1 | right pole 1 | 1 | left | 1 | 5 |
element_2 | left pole 1 | right pole 1 | 5 | left | 1 | 5 |
element_3 | left pole 1 | right pole 1 | 4 | left | 1 | 5 |
The columns element
, left_pole
, right_pole
, and rating
are mandatory, the columns preferred_pole
, rmin
,
and rmax
are optional. rmin
and rmax
contain the min and max of the rating scale. Alternatively, you may
pass rmin
and rmax
as arguments in the function call. See sample dataframe df_long.
See also
Import data
importExcel()
,
importGridcor()
,
importGridstat()
,
importGridsuite()
,
importScivesco()
,
importTxt()
Examples
# dataframe with elements as columns (preferred way)
importDataframe(df_element_columns)
#>
#> META DATA:
#> Number of elements: 4
#> Number of constructs: 3
#> Preferred poles defined: 3/3
#>
#> SCALE INFO:
#> The grid is rated on a scale from 1 (left pole) to 5 (right pole)
#>
#> RATINGS:
#> element 2 - 2 3 - element 3
#> element 1 - 1 | | 4 - element 4
#> | | | |
#> left pole 1 (+1) 5 3 1 4 (1-) right pole 1
#> left pole 2 (-2) 3 3 5 3 (2+) right pole 2
#> left pole 3 (/3) 2 4 2 3 (3/) right pole 3
#>
#> Poles: (+) = preferred , (-) = non-preferred , (/) = none , (.) = not defined
# dataframe with constructs as columns
importDataframe(df_construct_columns, format = "construct_columns", rmin = 1, rmax = 5)
#>
#> META DATA:
#> Number of elements: 4
#> Number of constructs: 3
#> Preferred poles defined: 0/3
#>
#> SCALE INFO:
#> The grid is rated on a scale from 1 (left pole) to 5 (right pole)
#>
#> RATINGS:
#> element 2 - 2 3 - element 3
#> element 1 - 1 | | 4 - element 4
#> | | | |
#> left pole 1 (.1) 5 3 1 4 (1.) right pole 1
#> left pole 2 (.2) 3 3 5 3 (2.) right pole 2
#> left pole 3 (.3) 2 4 2 3 (3.) right pole 3
#>
#> Poles: (+) = preferred , (-) = non-preferred , (/) = none , (.) = not defined
# dataframe with long format
importDataframe(df_long, format = "long", rmin = 1, rmax = 5)
#>
#> META DATA:
#> Number of elements: 4
#> Number of constructs: 3
#> Preferred poles defined: 3/3
#>
#> SCALE INFO:
#> The grid is rated on a scale from 1 (left pole) to 5 (right pole)
#>
#> RATINGS:
#> element 2 - 2 3 - element 3
#> element 1 - 1 | | 4 - element 4
#> | | | |
#> left pole 1 (+1) 5 3 1 4 (1-) right pole 1
#> left pole 2 (-2) 3 3 5 3 (2+) right pole 2
#> left pole 3 (/3) 2 4 2 3 (3/) right pole 3
#>
#> Poles: (+) = preferred , (-) = non-preferred , (/) = none , (.) = not defined