[R] how can I write two objects together, problem with cbind()

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Thu Feb 16 00:07:43 CET 2006


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




More information about the R-help mailing list