Skip to content
Back to formatted view

Raw Message

Message-ID: <42d0a5730903262208g1bcd32c8q876a20455936c0ee@mail.gmail.com>
Date: 2009-03-27T05:08:18Z
From: Daren Tan
Subject: Combining multiple dataframes in a list

I have a list containing multiple dataframes. Depending on whether the
dataframes have 1 column or more than 1 columns, the column names are
named differently. How can I force single column dataframes to have
prefixed column names ?

> m<- list(fc=data.frame(A=1:3))
> do.call(cbind, m)
  A
1 1
2 2
3 3

> m<- list(fc=data.frame(A=1:3, B=2:4))
> do.call(cbind, m)
  fc.A fc.B
1    1    2
2    2    3
3    3    4