[R] subscript out of bounds help

From: Rajasekaramya <ramya.victory_at_gmail.com>
Date: Tue, 29 Jul 2008 08:36:14 -0700 (PDT)

(mean.std.s2n.loss.gain[[1]])

        Probe.Set.ID rho_prime rho_prime_sd pom Expr1 matchinggenes Mean std_dev

29     SNP_A-1908463        47         2.47     0.75     0         PRKCZ

-0.34561617 0.13443676
30 SNP_A-2131370 44 2.61 0.58 0 PRKCZ
-0.32704692 0.15171799
31 SNP_A-2203009 45 2.67 0.58 0 PRKCZ
-0.32423938 0.15554016
32 SNP_A-2098546 43 2.81 0.58 1 PRKCZ
-0.32129822 0.15939414
33 SNP_A-2264565 42 2.90 0.58 1 PRKCZ 0.34055150 0.17828152 34 SNP_A-1788728 41 2.84 0.58 1 PRKCZ 0.33953744 0.17782981 35 SNP_A-1842509 34 2.59 0.58 1 PRKCZ
-0.29742398 0.14795647
36 SNP_A-4250389 33 2.60 0.50 1 PRKCZ
-0.29494191 0.14550642
1398 SNP_A-1834906 25 1.90 0.42 0 FRAP1
-0.27104942 0.03668130
1399 SNP_A-2146504 25 1.90 0.42 0 FRAP1
-0.27021592 0.03623132
1400 SNP_A-2307309 25 1.90 0.42 0 FRAP1
-0.06187095 0.08202400
1401 SNP_A-2261658 27 2.07 0.42 0 FRAP1
-0.27679100 0.04101169
1402 SNP_A-4274481 29 2.21 0.42 0 FRAP1
-0.27713433 0.04126666
1403 SNP_A-2053070 29 2.21 0.42 0 FRAP1
-0.28584483 0.05010136
1404 SNP_A-4276382 29 2.21 0.42 0 FRAP1

-0.30063342 0.05233933

mean.std.s2n.loss.gain is a list object of length 1000. I want to calculate the mean and std dev for the unique genes using the column 7 values.I wrote a code but it showing me subscript out of bounds error for .unique.genes[[i]].Could any body help me fixing the error.

genes.info.unique <- lapply(mean.std.s2n.loss.gain,function(.unique){ .unique.genes<-unique(.unique[,6])
.unique.genes<-as.vector(as.matrix(.unique.genes)) snpnumber<-list()
mean.genes<-list()
sd.genes<-list()
class(.unique.genes)
for(i in 1:length(.unique.genes))
{
snpnumber[[i]]<- length(.unique[.unique[,6] %in% .unique.genes[[i]],1]) mean.genes[[i]]<-mean(.unique[.unique[,6] %in% .unique.genes[[i]],7]) sd.genes[[i]]<-sd(.unique[.unique[,6] %in% .unique.genes[[i]],7]) }
cbind(.unique.genes,unlist(snpnumber),unlist(mean.genes),unlist(sd.genes)) })

kindly help me

Ramya

--

View this message in context: http://www.nabble.com/subscript-out-of-bounds-help-tp18714594p18714594.html Sent from the R help mailing list archive at Nabble.com.



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 Tue 29 Jul 2008 - 15:39:04 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 Tue 29 Jul 2008 - 16:32:47 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