[R] dataframe layout

Robert Baer rbaer at atsu.edu
Wed Mar 14 09:53:00 CET 2007


Can someone remind me how to change the columns in df.a into a two column 
df.b that contains one column of data and another column of the original 
column headings as levels.

Example:
a=1:3
b=4:6
c=7:9
df.a=data.frame(a,b,c)

Should become in df.b:
dat   lev
1      a
2      a
3      a
4      b
5      b
6      b
7      c
8      c
9      c

Thanks.



More information about the R-help mailing list