Re: how can I write two objects together, problem with cbind( )

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: how can I write two objects together, problem with cbind( )

Liaw, Andy
See ?merge.

Andy

From: Srinivas Iyyer

>
> Hi Group,
>  I have two objects
> 1. A data.frame with 2 columns
>
> Apple  4
> Boy    2
> Cat    5
> Dog    10
> Eel    9
> ...
> Zebra  10
> (26 rows)
>
> I have another object which was obtained as vector of
> integers with names as character.
>
> Fruit 10
> King 20
> Eel  19
> Boy 20
> Apple 15
> ...
> (26 rows)
>
> Now I wanted to combine the two objects and wanted a
> result that would look like this:
>
> Apple  4 15
> Boy    2 20
> Cat    5 28
> Dog    10 25
> Eel    9 19
>
>
> result <- cbind(obj1, obj2)
>
> My result is now jumbled:
>
> Apple  4 34
> Boy    2 21
> Cat    5 234
> Dog    10 23
> Eel    9  12
>
> I want to write identical row names elements together.
>
>
> What could be done here. Could any one please help me.
>
>
> thanks
> Srini
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html