importExcel {OpenRepGrid} | R Documentation |
Import grid data from an Excel file.
Description
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 |
dir |
Alternative way to supply the directory where the file is located
(default |
sheetIndex |
The number of the Excel sheet that contains the grid data. |
min |
Optional argument ( |
max |
Optional argument ( |
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.
1 | E1 | E2 | E3 | E4 | 5 |
left pole 1 | 1 | 5 | 3 | 4 | right pole 1 |
left pole 2 | 3 | 1 | 1 | 3 | right pole 2 |
left pole 3 | 4 | 2 | 5 | 1 | right 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.
Value
A single repgrid
object in case one file and
a list of repgrid
objects in case multiple files are imported.
See Also
importGridcor()
,
importGridstat()
,
importScivesco()
,
importGridsuite()
,
importTxt()
Examples
## Not run:
# 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)
## End(Not run)