importExcel: Import grid data from an Excel file.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/import.r

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

1
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.

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.

Author(s)

Mark Heckmann

See Also

importGridcor, importGridstat, importScivesco, importGridsuite, importTxt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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)

markheckmann/OpenRepGrid documentation built on April 30, 2021, 2:33 a.m.