[R] How to generate a list of lists recursively (for bayesm)

moritz.marienfeld at arcor.de moritz.marienfeld at arcor.de
Tue Mar 28 10:54:39 CEST 2006

Dear all,

I need to generate a list of lists as required by the bayesm-package. This means in my application that I have to generate a list which consists of 2000 elements, which are lists themselves:


The y are vectors and the X are matrices of different dimensions. I tried to solve this problem iteratively by the following code, but received an error message, which I do not understand: 

> for(i in 1:1067){
+ c<-0
+ for(j in 1:300){
+ if(Sk[i,j]!=0){
+ c<-c+1
+ if(c==1){
+ X1<-att[j,]
+ X2<-attq8[j,]
+ y<-Sk[i,j]
+ }
+ else{
+ X1<-rbind(X1,att[j,])
+ X2<-rbind(X2,attq8[j,])
+ y<-rbind(y,Sk[i,j])
+ }
+ }}
+ regdata1[[c(i,1)]]<-y
+ regdata1[[c(i,2)]]<-X1
+ regdata2[[c(i,1)]]<-y
+ regdata2[[c(i,2)]]<-X2
+ }
Fehler: objekt "regdata1" nicht gefunden

??? So, does anybody know what I did wrong or how I can generate my list of lists?



Moritz Marienfeld

Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig
und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer,
nur  44,85 €  inkl. DSL- und ISDN-Grundgebühr!

More information about the R-help mailing list