Skip to content
Prev 149763 / 398498 Next

Assoociative array?

I am using a simple R statement to read in the file:

a <- read.csv("Sample.dat", header=TRUE)

There is alot of data but the first few lines look like:

DayOfYear,Quantity,Fraction,Category,SubCategory
1,82,0.0000390392720794458,(Unknown),(Unknown)
2,78,0.0000371349173438631,(Unknown),(Unknown)
. . .
71,2,0.0000009521773677913,WOMEN,Piratesses
72,4,0.0000019043547355827,WOMEN,Piratesses
73,3,0.0000014282660516870,WOMEN,Piratesses
74,14,0.0000066652415745395,WOMEN,Piratesses
75,2,0.0000009521773677913,WOMEN,Piratesses

If I read the data in as above, the command

a[1]

results in the output 

[ reached getOption("max.print") -- omitted 16193 rows ]]

Shouldn't this be the first row?

a$Category[1]

results in the output

[1] (Unknown)
4464 Levels:   Tags ... WOMEN

But

a$Category[365]

gives me:

[1] 7 Plates   (Dessert),Western\n120,5,0.0000023804434194784,7 Plates   (Dessert)
4464 Levels:   Tags ... WOMEN

There is something fundamental about either vectors of the read.csv command that I am missing here.

Thank you.

Kevin
---- jim holtman <jholtman at gmail.com> wrote: