Convert X11 rgb.txt file to matrix

DESCRIPTION:
Returns a matrix of color specifications based on the RGB (Red-Green-Blue) triples found in an X11 rgb.txt file.

USAGE:
rgb2matrix(file="/usr/lib/X11/rgb.txt")

OPTIONAL ARGUMENTS:
file:
character string naming the file to be read. This file is assumed to consist of lines of the following form:

<red> <green> <blue> <color name>

where "<red>", "<green>" and "<blue>" are integers from 0 to 255 representing the amount of that color to be used in the color named by "<color name>".


VALUE:
The row names of the returned matrix will be the color names. There will be a column for each component of the color (red, green, blue). The values specified in the rgb.txt file are integers in the range 0 to 255. They will be scaled into the range 0.0 to 1.0 in the resulting matrix.

DETAILS:
The matrix produced by this function can be used as a "master" dataset of color values. It can be subsetted to get a matrix of colors that can be used with the postscript printing facility of some of the device drivers. Note that row names are case sensitive, so the case of the color names must be matched when subsetting from the matrix. With X11 color specification the case of the color name is ignored.

REFERENCES:
Quercia, V. and O'Reilly, T. (1988) X Window System User's Guide. O'Reilly & Associates, Inc.

SEE ALSO:
rgb.data , postscript , postscript.opts

EXAMPLES:
# Get the rgb.txt file from default location and run postscript
 rgb.data <- rgb2matrix()
 postscript (ps.colors = rgb.data[c("OrangeRed", "PaleGreen", "Navy",
"Indigo"),])