[R] problem withrbind function

jim holtman jholtman at gmail.com
Mon Feb 1 13:47:50 CET 2010


You can change the column names with 'colnames'.  If they have the
same number of columns, then you can give them consistent names and
they will 'rbind' together.  In the case where they have different
column names, do you want to create as output something with 4 columns
with the missing rows filled in with NAs?

On Mon, Feb 1, 2010 at 3:49 AM, venkata kirankumar
<kiran4u2all at gmail.com> wrote:
> Hi all,
> I am trying to to merge two data.frames(kk and ff)
> like
>
>
>> kk
>  a b d
> 1 1 4 7
> 2 2 5 8
> 3 3 6 9
>
>> ff
>  a b d
> 1 2 5 8
> 2 3 6 9
> 3 4 7 1
>
> and
> g<-rbind(kk,ff)
> is working perfectly and giving results
> but if any of the column name changed then its giving
>
> "Error in match.names(clabs, names(xi)) :
>  names do not match previous names"
>
>
> like
>
>  > kk
>  a b d
> 1 1 4 7
> 2 2 5 8
> 3 3 6 9
>
>> ff
>  a b f
> 1 2 5 8
> 2 3 6 9
> 3 4 7 1
>
> and
> g<-rbind(kk,ff)
>
> can any one suggest how can I bind by rows
>
> or
>
> is there any way to change the column name in any date frame
> this one also heps me
>
> please help me to get the dateframe which combines both
>
> thanks in advance
>
> kiran
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list