Re: [R] Assoociative array?

From: <rkevinburton_at_charter.net>
Date: Sat, 12 Jul 2008 09:31:46 -0700


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


R-help_at_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. Received on Sat 12 Jul 2008 - 16:48:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 12 Jul 2008 - 17:32:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive