[R] problem with as.data.frame.table

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Jan 16 21:05:04 CET 2003


Tord Snall <tord.snall at ebc.uu.se> writes:

> Dear all, 
> 
> I think that what I want is an as.data.frame.table-object, but see error
> message below.

(Haven't we been here before??)

There's no such thing as an as.data.frame.table-object.
as.data.frame.table turns table objects into data frames.
 
> I have a data frame with one tree per row, diaclass tells if it is a small,
> mid or large tree
> 
> > cpy.tradart[1:5, ]
>   ObjektID diaclass
> 1 AX.Grb.1   bigdia
> 2 AX.Grb.1   middia
> 3 AX.Grb.1   middia
> 4 AX.Grb.1 smalldia
> 5 AX.Grb.1   middia
> > 
> 
> I want a data frame telling no of trees per diameter class, per ObjektID

What's wrong with as.data.frame(table(ObjektID,diaclass)) then?


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list