[R] subscript out of bounds error.

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

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

      Probe.Set.ID   rho_prime  r ho_prime_sd    pom   Expr1   
matchinggenes         Mean     std_dev 
29     SNP_A-1908463        47         2.47     0.75      0         PRKCZ -           
0.34560.      1344         30     SNP_A-2131370        44         2.61     
0.58     0         PRKCZ               -0.3270        0.1517 
31     SNP_A-2203009        45         2.67      0.58     0         PRKCZ             

-0.3242 .1555
32 SNP_A-2098546 43 2.81 0.58 1 PRKCZ
-0.3212 0.155
33 SNP_A-2264565 42 2.90 0.58 1 PRKCZ 0.340 0.1782 34 SNP_A-1788728 41 2.84 0.58 1 PRKCZ 0.339 .1778 1398 SNP_A-1834906 25 1.90 0.42 0 FRAP1
-0.2710 0.03668
1399 SNP_A-2146504 25 1.90 0.42 0 FRAP1
-0.270 0.03627
1400 SNP_A-2307309 25 1.90 0.42 0 FRAP1
-0.061 0.0820
1401 SNP_A-2261658 27 2.07 0.42 0 FRAP1
-0.276 0.04101
1402 SNP_A-4274481 29 2.21 0.42 0 FRAP1
-0.277 0.0412
1403 SNP_A-2053070 29 2.21 0.42 0 FRAP1
- 0.285 0.0501
1404 SNP_A-4276382 29 2.21 0.42 0 FRAP1
-0.30060 .0523

mean.std.s2n.loss.gain is a l;ist object of length 1000.for sample i have provided with 1 element in the list.

I want to calculate the mean and std dev for the unique genes.I wrote a code for that.but it is throwing me an error subscript out of bounds for .unique.genes[[i]]

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-error.-tp18714563p18714563.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:29:23 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 - 15:32:46 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