Hi Nick,

Your first column is being stored as a factor. You can either take care when creating the matrix to keep the values in this column as characters, or you might want to convert the result using as.character().

HTH,
Tom

On Dec 28, 2009, at 1:14 PM, Nick Torenvliet wrote:

Consider the following....

fileLines
     V1       V2    V3    V4     V5     V6    V7     V8
1     AB 20091224 156.0 156.0 154.00 154.00    55   1198
2   AB.C 20091224 156.0 156.0 156.00 156.00     0      0
3  ABF10 20091224 156.0 156.0 156.00 156.00    55    444
4  ABH10 20091224 156.0 156.0 156.00 156.00     0    749
5  ABH11 20091224 157.2 157.2 157.20 157.20     0      0
6  ABH12 20091224 157.2 157.2 157.20 157.20     0      0
7  ABK10 20091224 157.2 157.2 157.20 157.20     0      5
8  ABK11 20091224 157.2 157.2 157.20 157.20     0      0
9  ABN10 20091224 157.2 157.2 157.20 157.20     0      0
10 ABN11 20091224 157.2 157.2 157.20 157.20     0      0
11 ABV10 20091224 157.2 157.2 157.20 157.20     0      0
12 ABV11 20091224 157.2 157.2 157.20 157.20     0      0
13 ABZ10 20091224 157.2 157.2 157.20 157.20     0      0
14 ABZ11 20091224 157.2 157.2 157.20 157.20     0      0
15    RS 20091224 395.0 395.0 381.42 381.42 12918 100618
16  RS.C 20091224 395.0 399.1 395.00 398.70  1680      0
17 RSF10 20091224 395.0 399.1 395.00 398.70  2277   3081
18 RSF11 20091224 420.3 420.3 420.30 420.30    50    203
19 RSF12 20091224 415.5 415.5 415.50 415.50     0      0
20 RSH10 20091224 401.1 403.9 399.50 403.60  9925  79548
21 RSH11 20091224 419.2 419.2 419.20 419.20     0    193
22 RSK10 20091224 406.9 409.9 406.40 409.90   264   5769
23 RSK11 20091224 415.5 415.5 415.50 415.50     0      0
24 RSN10 20091224 414.7 415.2 410.00 415.20   189   6391
25 RSN11 20091224 415.5 415.5 415.50 415.50     0      2
26 RSX10 20091224 414.9 417.9 413.00 417.30   213   5431
27 RSX11 20091224 415.5 415.5 415.50 415.50     0      0
28    WF 20091224 363.0 363.0 363.00 363.00     0      0
29    WW 20091224 152.0 152.0 152.00 152.00     0      0

attributes (fileLines)
$names
[1] "V1" "V2" "V3" "V4" "V5" "V6" "V7" "V8"

$class
[1] "data.frame"

$row.names
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25
[26] 26 27 28 29

fileLines[1,2]
[1] 20091224
As expected!

fileLines[1,3]
[1] 156
As expected!

fileLines[1,1]
[1] AB
29 Levels: AB AB.C ABF10 ABH10 ABH11 ABH12 ABK10 ABK11 ABN10 ABN11 ... WW
Doh!

How do I access the "AB" element directly?

Nick

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to