Learn R Programming

OpenRepGrid (version 0.1.18)

importExcel: Import grid data from an Excel file.

Description

You can define a grid in a Microsoft Excel file (suffix .xlsx). The file must have one of two formats (wide or long, see format sections below).

Usage

importExcel(file, sheet = 1, format = "wide", rmin = NULL, rmax = NULL)

Value

A repgrid object (one input file) or a named list with repgrid objects (several input files). List names are filename + sheet.

Arguments

file

Path(s) to Excel file(s) (suffix .xlsx).

sheet

Names or indexes of sheet with grid data to import.

format

Two formats are supported. wide (default): each column represents one element, each row represent one constructs. long: each row contains one rating value for a element-construct combination. See sections below and examples.

rmin, rmax

Min and max of the rating scale (numeric, default NULL).

Format <code>wide</code>

In the wide format, each element has a separate column, and each row contains the ratzings for one construct. It is a common way to represent grid data and looks like this:

1element_1element_2element_3element_45preferred
left_pole_11534right_pole_1left
left_pole_23113right_pole_2right
left_pole_34251right_pole_3NA

The header row 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()).

Format <code>long</code>

The long format has this name because it has few columns and many 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:

elementleft_poleright_poleratingpreferred_polerminrmax
element 1left pole 1right pole 11left15
element_2left pole 1right pole 15left15
element_3left pole 1right pole 14left15

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 Also

Import data importDataframe(), importGridcor(), importGridstat(), importGridsuite(), importScivesco(), importTxt()