[R] coef(summary) and plyr

moleps moleps2 at gmail.com
Tue Aug 10 01:11:23 CEST 2010


correction...

Col and rows were mixed up and loop only worked when rows were less than or equal to number of columns....

//M


test<-function(a){
	coef(summary(a))->lo
a<-colnames(lo)
b<-rownames(lo)
c<-length(a)
e<-character(0)
r<-NULL
for (x in (1:length(b))){
	d<-rep(paste(a[1:c],b[x],sep=" "))
	e<-paste(c(e,d))
	t<-lo[x,]
	r<-c(r,t)
	names(r)<-e
	}
	return(r)
}

On 9. aug. 2010, at 19.55, Hadley Wickham wrote:

>>> That's exactly what dlply does - so you should never have to do that
>>> yourself.
>> 
>> I'm unclear what you are saying. Are you saying that the plyr function
>> _should_ have examined the objects in that list and determined that there
>> were 4 rows and properly labeled the rows to indicate which list they came
>> from?
> 
> Yes, exactly.  It's the output from coef(summary(x)) that makes it
> look like this isn't happening.
> 
> Hadley
> 
> -- 
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/



More information about the R-help mailing list