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

From: Srinivas Iyyer <srini_iyyer_bio_at_yahoo.com>
Date: Thu 16 Feb 2006 - 10:07:43 EST


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Feb 16 10:31:02 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:31 EST