On Aug 19, 2012, at 5:56 PM, Sapana Lohani wrote:

Hi,


My data.frame "A" has FID like this

FID

a

a
b
b
b
c
c
d
d
d
d

Now my second data.frame "B" has age value for a, b, c, d like

FID Age

a      5

b      7
c      9
d      3

How can search for the Age column in "B" and replace the values in "A" so that my new "A" looks like this

? merge

Perhaps

merge(A, B)
# although the ambiguities inherent in posting only screen output instead of the greatly-to-be-preferred output of dput() makes this a guess.


FID Age

a      5
a      5
b      7
b      7
b      7
c      9
c      9
d      3
d      3
d      3
d      3

Thanks you

        [[alternative HTML version deleted]]

And posting html is a deprecated format for rhelp.

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

(Console output does not qualify as reproducible.)


--

David Winsemius, MD
Alameda, CA, USA

______________________________________________
R-help@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.

Reply via email to