Re: [R] Replacing variables in one dataset with those from another

2011-06-01 Thread Dennis Murphy
Hi: Letting d1 and d2 be your two data frames, > merge(d1, d2, by.x = 'x1', by.y = 'num', all.x = TRUE)[, c(2, 4, 3)] grpnum uniqueid x2 1 D 276 2 B 898 3 A GHU82RK02HD7D6 334 4 C GHU82RK02IXPC7 4077 If you want x1 to be the variable name fo

[R] Replacing variables in one dataset with those from another

2011-06-01 Thread mcginnis21
Hoping someone out there can help me...this seems like an easy task but I can't figure it out... I want to replace variables in one dataset (Dataset1) with a variable from another dataset (Dataset2). All the values for variables x1 and x2 in Dataset1 have a unique match to the variable uniquenum