My apology to the list, as it turns out the moment after I hit the send button, I found that the first element in the list was a null. The error message reflects that.
> _____________________________________________ > From: Barker, Chris > Sent: Friday, December 12, 2008 6:30 > To: 'r-help@r-project.org' > Subject: simple list question > > > I'd appreciate some tips, I'm making a simple mistake trying to > extract elements from a list of fit objects. > > The following command works, coef( cph.list[[1]] ) ,.... coef( > cph.list[[3]] ) and so forth. These extract regression coefficients > from the appropriate list element. > > When I try to run this inside a for loop, or an lapply > (lapply(cph.list,coef)) I get this error message > > > > for (ii in (1:22)){ > + cat(ii,fill=T) > + print(coef( cph.list[[ii]] )) > + > + } > 1 > Error in object$coefficients : $ operator is invalid for atomic > vectors > > Suggestions appreciated. > Thanks in advance. > > > > > Chris Barker, Ph.D. > Statistical Consultant > [[alternative HTML version deleted]] ______________________________________________ R-help@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.