Skip to content

convert table to list

1 message · Peter Alspach

#
Tena koe Herwig

I am guessing that you are not using the terms 'table' and 'list' in the
R sense, and suggest you might want either the reshape() function or
Hadley Wickham's 'reshape' package.

For the former, if your data is in a data.frame (which is a special type
of list) then:
A  B  C  D
x 10 20 30 40
y 11 21 31 41
z 12 NA 32 42
'data.frame':   3 obs. of  4 variables:
 $ A: int  10 11 12
 $ B: int  20 21 NA
 $ C: int  30 31 32
 $ D: int  40 41 42
ids=row.names(herwig),
          times=names(herwig))
    time  A id
x.A    A 10  x
y.A    A 11  y
z.A    A 12  z
x.B    B 20  x
y.B    B 21  y
z.B    B NA  z
x.C    C 30  x
y.C    C 31  y
z.C    C 32  z
x.D    D 40  x
y.D    D 41  y
z.D    D 42  z

HTH ....

Peter Alspach
The contents of this e-mail are confidential and may be subject to legal privilege.
 If you are not the intended recipient you must not use, disseminate, distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received this
 e-mail in error, please notify the sender and delete all material pertaining to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.