Skip to contents

You can define a grid using Microsoft Excel and by saving it as a .xlsx file. The .xlsx file has to be in a specified fixed format (see section Details).

Usage

importExcel(file, dir = NULL, sheetIndex = 1, min = NULL, max = NULL)

Arguments

file

A vector of filenames including the full path if file is not in current working directory. The file suffix has to be .xlsx (used since Excel 2007).

dir

Alternative way to supply the directory where the file is located (default NULL).

sheetIndex

The number of the Excel sheet that contains the grid data.

min

Optional argument (numeric, default NULL) for minimum rating value in grid.

max

Optional argument (numeric, default NULL) for maximum rating value in grid.

Value

A single repgrid object in case one file and a list of repgrid objects in case multiple files are imported.

Details

Excel file structure: The first row contains the minimum of the rating scale, the names of the elements and the maximum of the rating scale. Below every row contains the left construct pole, the ratings and the right construct pole.

1E1E2E3E45
left pole 11534right pole 1
left pole 23113right pole 2
left pole 34251right pole 3

Note that the maximum and minimum value has to be defined using the min and max arguments if no values are supplied at the beginning and end of the first row. Otherwise the scaling range is inferred from the available data and a warning is issued as the range may be erroneous. This may effect other functions that depend on knowing the correct range and it is thus strongly recommended to set the scale range correctly.

Examples

if (FALSE) { # \dontrun{

# Open Excel file delivered along with the package
file <- system.file("extdata", "grid_01.xlsx", package = "OpenRepGrid")
rg <- importExcel(file)

# To see the structure of the Excel file try to open it as follows.
# Requires Excel to be installed.
system2("open", file)

# Import more than one Excel file
files <- system.file("extdata", c("grid_01.xlsx", "grid_02.xlsx"), package = "OpenRepGrid")
rg <- importExcel(files)
} # }