Re: [R] converting lists got by tapply to dataframes

About this list Date view Thread view Subject view Author view Attachment view

From: Andrew Robinson (andrewr@uidaho.edu)
Date: Thu 11 Mar 2004 - 03:01:54 EST


Message-id: <200403100801.54685.andrewr@uidaho.edu>

Wolfram,

try

unlist(xb)

Andrew

On Wednesday 10 March 2004 06:58, Wolfram Fischer wrote:
> I have two lists:
>
> xa <- list( X=c(1,2,3), Y=c(4,5,6), Z=c(7,8,9) )
>
> xb <- with( barley, tapply( X=seq(1:nrow(barley)), INDEX=site
> , FUN=function(z)yield[z]))
>
> I can convert xa to a dataframe easily with:
> as.data.frame(xa)
>
> But if i try the same with xb I get:
> as.data.frame(xb)
> Error in as.data.frame.default(xb) :
> can't coerce array into a data.frame
>
> What helps?
>
> (NB: I know the formula for xb is stupid, but it generates the same
> type of list as the list I get from my real problem.)
>
> Wolfram
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

-- 
Andrew Robinson                      Ph: 208 885 7115
Department of Forest Resources       Fa: 208 885 6226
University of Idaho                  E : andrewr@uidaho.edu
PO Box 441133                        W : http://www.uidaho.edu/~andrewr
Moscow ID 83843                      Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Fri 23 Apr 2004 - 18:36:35 EST