50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

OpenRepGrid (version 0.1.9)

importExcel: Import grid data from an Excel file.

Description

If you do not have a grid program at hand you can define a grid using Microsoft Excel and by saving it as a .xlsx or .xls file. The .xlsx or .xls file has to be in specified fixed format. 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.

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 or .xls. If no file is supplied a selection pop up menu is opened to select the files.
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

1 & element 1 & element 2 & element 3 & 5 1 & element 1 & element 2 & element 3 & 5 1 & element 1 & element 2 & element 3 & 5 1 & element 1 & element 2 & element 3 & 5

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.

A sample Excel file can be found here: http://www.openrepgrid.uni-bremen.de/data/grid.xlsx.

See Also

importGridcor, importGridstat, importScivesco, importGridsuite, importTxt

Examples

Run this code
## Not run: 
# 
# # using the pop-up selection menu
# rg <- importExcel()
# 
# # supposing that the data file sample.txt is in the current directory
# file <- "grid.xlsx"
# rg <- importExcel(file)
# 
# # specifying a directory (arbitrary example directory)
# dir <- "/Users/markheckmann/data"
# rg <- importExcel(file, dir)
# 
# # using a full path
# rg <- importExcel("/Users/markheckmann/data/grid.xlsx")
# 
# # import more than one Excel file via R code
# files <- c("grid_1.xlsx", "grid_2.xlsx")
# rg <- importExcel(files)
# ## End(Not run)

Run the code above in your browser using DataLab