[R] copy the columns based on the code
MSousa
ricardosousa2000 at clix.pt
Mon Mar 26 17:08:44 CEST 2012
thanks for the reply,
But does not the results I need. What is confusing is that when making
the first merge it gives only two cities when it should take three
travel<-data.frame(pos=1,Source=1,Destine=2)
travel<-rbind(travel,data.frame(pos=1,*Source=1*,Destine=3))
travel<-rbind(travel,data.frame(pos=2,*Source=3*,Destine=4))
travel<-rbind(travel,data.frame(pos=3,*Source=2*,Destine=4))
travel<-rbind(travel,data.frame(pos=4,*Source=1*,Destine=3))
temp1 <- merge(travel, city, by.x='Source', by.y='cod')
>temp1 ()
Source pos Destine city
1 *1* 1 2 Barcelona
2 1 1 3 Barcelona
3 1 4 3 Barcelona
4 *2 * 3 4 Madrid
--
View this message in context: http://r.789695.n4.nabble.com/copy-the-columns-based-on-the-code-tp4505253p4506102.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list