Thanks to all who responded: Arjun Bhandari, Rich Herberger and David
Lorenz,
Rich suggested an approach using "match", it works nicely if there is a
unique match from the large data.frame, but in this case there is multiple
matches and "match" will only return the first match.
David Lorenz suggested to use "merge", which I did after testing on a small
example. Very fast and efficient:
> resources(tmp.b2 <- merge(x = QcProf.Ass.b2,
+ y = StatCanCNP[, c('CodeProf', 'SC.CNP',
'Education',
+ 'CdIndus')],
+ by.x = 'newprof', by.y = 'CodeProf', all.x =
T))
User time = 0 h. 0 min. 55.27 s.
System time = 0 h. 0 min. 0.91 s.
CPU time = 0 h. 0 min. 56.18 s.
Elapsed time = 0 h. 0 min. 56.42 s.
Child = 0 h. 0 min. 0.00 s.
% CPU = 99.57
Memory usage:
Cache = 0 Bytes
Working = 755.029467M Bytes
Thanks again for the help,
Gérald Jean
Analyste-conseil (statistiques), Actuariat
télephone : (418) 835-4900 poste (7639)
télecopieur : (418) 835-6657
courrier électronique: gerald.jean@dgag.ca
"In God we trust all others must bring data" W. Edwards Deming
|