Load grids

The OpenRepGrid R package is able to read files from different other grid programs as well as standard formats (i. e. .txt). Not all file formats have yet been implemented. The following section explains how to read the different formats. All import functions follow the same naming scheme. They start with the word import followed by the program the file is imported from, e.g. Gridstat. Hence the function to import a Gridstat file is called importGridstat.

.txt files
If you do not have a grid program at hand you can define a grid using a standard text editor and by saving it as a .txt file. The .txt file has to be in a fixed format. There are three mandatory blocks each starting and ending with a predefined tag in uppercase letters. The first block starts with ELEMENTS and ends with END ELEMENTS and contains one element in each line. The other mandatory blocks contain the constructs and ratings (see below). In the block containing the constructs the left and right pole are seperated by a colon. The order of the blocks is arbitrary. All text not contained within the blocks is discarded and can thus be used for comments.

example.txt file ---

anything not contained within the tags will be discarded

ELEMENTS element 1 element 2 element 3 END ELEMENTS

CONSTRUCTS left pole 1 : right pole 1 left pole 2 : right pole 2 left pole 3 : right pole 3 left pole 4 : right pole 4 END CONSTRUCTS

RATINGS 1 3 2 4 1 1 1 4 4 3 1 1 END RATINGS

RANGE 1 4 END RANGE end of file

To load the .txt file and save it into the object x type the following code to the R console. You have to make sure, that the file exists in the current working directory. If not you either have to specify the whole path to the file or you must change the R working directory. x <- importTxt("markheckmann/data/examples.txt")     # whole path to file or

getwd                            # show current working directory setwd("markheckmann/data")         # change working directory to the folder markheckmann/data x <- importTxt("example.txt")      # load file that is in the current working directory

Another option that is available for all import functions is to supply no argument inside the brackets. In this case an interactive file selection dialog will open. x <- importTxt      # without any arguments

This will open the following dialog window which allows you to select a file manually.

Import from other grid programs
To import from other grid programs works the same as importing a .txt</tt> file. Either you specify the file name if it resides in the current R working directory, you supply the whole file path if it is not in the current directory or you do not supply any argumnets and and interactive file selection dialog window will open.

Gridcor
x <- importGridcor("gridcor.dat")                      # file in current R working directory or

x <- importGridcor("markheckmann/data/gridcor.dat")    # whole file path or

x <- importGridcor                                   # open file selection dialog

Gridstat
x <- importGridstat("gridstat.dat")                    # file in current R working directory or

x <- importGridstat("markheckmann/data/gridstat.dat")  # whole file path or

x <- importGridstat                                  # open file selection dialog

GridSuite
x <- importGridsuite("gridsuite.xml")                   # file in current R working directory or

x <- importGridsuite("markheckmann/data/gridsuite.xml") # whole file path or

x <- importGridsuite                                  # open file selection dialog

sci:vesco
x <- importScivesco("scivesco.scires")                  # file in current R working directory or

x <- importScivesco("markheckmann/data/scivesco.scires") # whole file path or

x <- importScivesco                                   # open file selection dialog